Matthias Mullie has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/269405

Change subject: Don't trigger new-topic notification when user is also 
mentioned in first post
......................................................................

Don't trigger new-topic notification when user is also mentioned in first post

Bug: T124803
Change-Id: I621bff4701603240bc05891915d9a9740684be0f
---
M includes/Notifications/Controller.php
1 file changed, 8 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Flow 
refs/changes/05/269405/1

diff --git a/includes/Notifications/Controller.php 
b/includes/Notifications/Controller.php
index 50e3edf..fbb5979 100644
--- a/includes/Notifications/Controller.php
+++ b/includes/Notifications/Controller.php
@@ -186,9 +186,16 @@
                }
 
                $mentionEvent = $this->generateMentionEvent( $topicTitle, 
$topicTitle, $topicWorkflow, $user );
+               $mentionedUsers = array();
                if ( $mentionEvent ) {
                        $events[] = $mentionEvent;
+                       $mentionedUsers = $mentionEvent->getExtraParam( 
'mentioned-users' );
                }
+
+               // also look at users mentioned in first post: if there are 
any, this
+               // notification shouldn't go through (because they'll already 
receive
+               // the mention notification)
+               $mentionedUsers += $this->getMentionedUsers( $firstPost, 
$topicWorkflow->getArticleTitle() );
 
                $events = array();
                $events[] = EchoEvent::create( array(
@@ -209,7 +216,7 @@
                                        
$topicWorkflow->getArticleTitle()->getArticleID( Title::GAID_FOR_UPDATE ),
                                ),
                                // pass along mentioned users to other 
notification, so it knows who to ignore
-                               'mentioned-users' => $mentionEvent ? 
$mentionEvent->getExtraParam( 'mentioned-users' ) : array(),
+                               'mentioned-users' => $mentionedUsers,
                        )
                ) );
 

-- 
To view, visit https://gerrit.wikimedia.org/r/269405
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I621bff4701603240bc05891915d9a9740684be0f
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Flow
Gerrit-Branch: master
Gerrit-Owner: Matthias Mullie <mmul...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to