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

Change subject: Remove primary link from the bundle of page linked notification
......................................................................


Remove primary link from the bundle of page linked notification

Also, make sure that the bundle follows the same behavior as the
xwiki bundle, where if it does not have a primary link, the 'click'
event triggers the 'expand' action.

Bug: T145902
Change-Id: I456bf76a7bd531ffcad5462708f37cd54d8af99d
---
M includes/formatters/PageLinkedPresentationModel.php
M modules/ui/mw.echo.ui.BundleNotificationItemWidget.js
2 files changed, 14 insertions(+), 4 deletions(-)

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



diff --git a/includes/formatters/PageLinkedPresentationModel.php 
b/includes/formatters/PageLinkedPresentationModel.php
index df9d757..bf7f73d 100644
--- a/includes/formatters/PageLinkedPresentationModel.php
+++ b/includes/formatters/PageLinkedPresentationModel.php
@@ -22,10 +22,14 @@
        }
 
        public function getPrimaryLink() {
-               return array(
-                       'url' => $this->getPageFrom()->getFullURL(),
-                       'label' => $this->msg( 
'notification-link-text-view-page' )->text(),
-               );
+               if ( $this->isBundled() ) {
+                       return false;
+               } else {
+                       return array(
+                               'url' => $this->getPageFrom()->getFullURL(),
+                               'label' => $this->msg( 
'notification-link-text-view-page' )->text(),
+                       );
+               }
        }
 
        public function getSecondaryLinks() {
diff --git a/modules/ui/mw.echo.ui.BundleNotificationItemWidget.js 
b/modules/ui/mw.echo.ui.BundleNotificationItemWidget.js
index 195280f..870cbc7 100644
--- a/modules/ui/mw.echo.ui.BundleNotificationItemWidget.js
+++ b/modules/ui/mw.echo.ui.BundleNotificationItemWidget.js
@@ -69,6 +69,12 @@
                // Events
                this.toggleExpandButton.connect( this, { click: 'expand' } );
 
+               if ( !this.model.getPrimaryUrl() ) {
+                       // If there's no primary link, make sure a click
+                       // triggers the 'expand' action
+                       this.$content.on( 'click', this.expand.bind( this ) );
+               }
+
                // Initialization
                this.populateFromModel();
                this.toggleExpanded( false );

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I456bf76a7bd531ffcad5462708f37cd54d8af99d
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/Echo
Gerrit-Branch: master
Gerrit-Owner: Mooeypoo <mor...@gmail.com>
Gerrit-Reviewer: Catrope <roan.katt...@gmail.com>
Gerrit-Reviewer: Mooeypoo <mor...@gmail.com>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to