Topic subscriptions: Only check for events on talk pages

Change-Id: Ic2b7536baea58fb4868cec6f477e72bd8b717e3a
This commit is contained in:
Ed Sanders 2021-04-08 13:12:07 +01:00 committed by Bartosz Dziewoński
parent bd9c3c7be7
commit 6cafd7735d

View file

@ -16,11 +16,13 @@ use Error;
use FauxRequest;
use Iterator;
use MediaWiki\Extension\DiscussionTools\CommentParser;
use MediaWiki\Extension\DiscussionTools\Hooks\HookUtils;
use MediaWiki\Extension\DiscussionTools\SubscriptionItem;
use MediaWiki\MediaWikiServices;
use MediaWiki\Revision\RevisionRecord;
use MediaWiki\User\UserFactory;
use MediaWiki\User\UserIdentity;
use Title;
use Wikimedia\Parsoid\Utils\DOMUtils;
class EventDispatcher {
@ -66,6 +68,14 @@ class EventDispatcher {
return;
}
$title = Title::newFromLinkTarget(
$newRevRecord->getPageAsLinkTarget()
);
if ( !HookUtils::isAvailableForTitle( $title ) ) {
// Not a talk page
return;
}
$oldParser = self::getParsedRevision( $oldRevRecord );
$newParser = self::getParsedRevision( $newRevRecord );
@ -88,7 +98,7 @@ class EventDispatcher {
$heading = $newComment->getHeading();
$events[] = [
'type' => 'dt-subscribed-new-comment',
'title' => $newRevRecord->getPageAsLinkTarget(),
'title' => $title,
'extra' => [
'subscribed-comment-name' => $heading->getName(),
'comment-id' => $newComment->getId(),