jenkins-bot has submitted this change and it was merged.

Change subject: Hide orange alert when the user is viewing a topic page related 
to their user talk page
......................................................................


Hide orange alert when the user is viewing a topic page related to their user 
talk page

Bug: T137954
Change-Id: Ie742b2d0ecfa8dfc48e820923516f2ca4f90ffa5
Depends-On: I0b49c3a5eb0a027f8839ab86e77c527357907dd0
---
M Flow.php
M Hooks.php
2 files changed, 22 insertions(+), 0 deletions(-)

Approvals:
  Catrope: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/Flow.php b/Flow.php
index 6ed46e7..b55721c 100644
--- a/Flow.php
+++ b/Flow.php
@@ -126,6 +126,7 @@
 $wgHooks['ApiFeedContributions::feedItem'][] = 
'FlowHooks::onContributionsFeedItem';
 $wgHooks['AbuseFilter-computeVariable'][] = 
'FlowHooks::onAbuseFilterComputeVariable';
 $wgHooks['AbortEmailNotification'][] = 'FlowHooks::onAbortEmailNotification';
+$wgHooks['BeforeDisplayOrangeAlert'][] = 
'FlowHooks::onBeforeDisplayOrangeAlert';
 $wgHooks['EchoAbortEmailNotification'][] = 
'FlowHooks::onEchoAbortEmailNotification';
 $wgHooks['BeforeEchoEventInsert'][] = 'FlowHooks::onBeforeEchoEventInsert';
 $wgHooks['ArticleEditUpdateNewTalk'][] = 
'FlowHooks::onArticleEditUpdateNewTalk';
diff --git a/Hooks.php b/Hooks.php
index 1345ac0..c520257 100644
--- a/Hooks.php
+++ b/Hooks.php
@@ -1015,6 +1015,27 @@
                return true;
        }
 
+       /**
+        * Hides the orange alert indicating 'You have a new message'
+        * when the user reads flow-topic replies.
+        *
+        * @param User $user
+        * @param Title $title
+        * @return bool true to show the alert, false to hide(abort) the alert
+        */
+       public static function onBeforeDisplayOrangeAlert( User $user, Title 
$title ) {
+               if( $title->getNamespace() === NS_TOPIC ) {
+                       $storage = Container::get( 'storage.workflow' );
+                       $uuid = WorkflowLoaderFactory::uuidFromTitle( $title );
+                       $workflow = $storage->get( $uuid );
+                       if ( $workflow ) {
+                               $boardTitle = $workflow->getOwnerTitle();
+                       }
+                       if ( $user->getTalkPage()->equals( $boardTitle ) ) {
+                               return false;
+                       }
+               }
+       }
 
        public static function onInfoAction( IContextSource $ctx, &$pageinfo ) {
                if ( $ctx->getTitle()->getContentModel() !== 
CONTENT_MODEL_FLOW_BOARD ) {

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ie742b2d0ecfa8dfc48e820923516f2ca4f90ffa5
Gerrit-PatchSet: 6
Gerrit-Project: mediawiki/extensions/Flow
Gerrit-Branch: master
Gerrit-Owner: Kmuthu <[email protected]>
Gerrit-Reviewer: Catrope <[email protected]>
Gerrit-Reviewer: Mooeypoo <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to