Fix user talk exception for blacklist

There was a null-dereference for events without titles.

Also, it should only whitelist their own user talk space, not e.g.
mentions on someone else's user talk space.

Bug: T150419
Bug: T166627
Change-Id: If7d9cad4eb33ce1f1e6b7d86244332ad5dece954
This commit is contained in:
Matthew Flaschen 2017-05-30 19:42:20 -04:00
parent 8b6191088e
commit 813ab5b54e

View file

@ -433,7 +433,19 @@ class EchoNotificationController {
// Apply blacklists and whitelists.
$notify->addFilter( function ( $user ) use ( $event ) {
if ( self::isBlacklistedByUser( $event, $user ) && $event->getTitle()->getNamespace() !== NS_USER_TALK ) {
$title = $event->getTitle();
if ( self::isBlacklistedByUser( $event, $user ) &&
(
$title === null ||
!(
// Still notify for posts anywhere in
// user's talk space
$title->getRootText() === $user->getName() &&
$title->getNamespace() === NS_USER_TALK
)
)
) {
return self::isWhitelistedByUser( $event, $user );
}