mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/DiscussionTools
synced 2024-11-24 08:23:52 +00:00
Ensure you can't get duplicate notifs for edits to your user talk page
We don't display [subscribe] buttons on your user talk page, but the API still allows those subscriptions. Use the same approach as for mentions to ensure this doesn't cause duplicate notifications. Remove some code in SubscribedNewCommentPresentationModel, now guaranteed to be unused. Change-Id: I99a276a48d8562552ed2c54cc0323e8e428845fd
This commit is contained in:
parent
4353b68646
commit
fd080b7043
|
@ -46,11 +46,14 @@ class EchoHooks {
|
|||
'user-locators' => [
|
||||
'MediaWiki\\Extension\\DiscussionTools\\Notifications\\EventDispatcher::locateSubscribedUsers'
|
||||
],
|
||||
// Exclude mentioned users and talk page owner from our notification, to avoid
|
||||
// duplicate notifications for a single comment
|
||||
'user-filters' => [
|
||||
[
|
||||
"EchoUserLocator::locateFromEventExtra",
|
||||
[ "mentioned-users" ]
|
||||
]
|
||||
],
|
||||
"EchoUserLocator::locateTalkPageOwner"
|
||||
],
|
||||
'presentation-model' =>
|
||||
'MediaWiki\\Extension\\DiscussionTools\\Notifications\\SubscribedNewCommentPresentationModel',
|
||||
|
|
|
@ -37,7 +37,7 @@ class SubscribedNewCommentPresentationModel extends EchoEventPresentationModel {
|
|||
* @inheritDoc
|
||||
*/
|
||||
public function getIconType() {
|
||||
return $this->isUserTalkPage() ? 'edit-user-talk' : 'chat';
|
||||
return 'chat';
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -118,17 +118,6 @@ class SubscribedNewCommentPresentationModel extends EchoEventPresentationModel {
|
|||
return $this->language->truncateForVisual( $content, EchoDiscussionParser::DEFAULT_SNIPPET_LENGTH );
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
protected function isUserTalkPage() {
|
||||
// Would like to do $this->event->getTitle()->equals( $this->user->getTalkPage() )
|
||||
// but $this->user is private in the parent class
|
||||
$username = $this->getViewingUserForGender();
|
||||
return $this->event->getTitle()->getNamespace() === NS_USER_TALK &&
|
||||
$this->event->getTitle()->getText() === $username;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue