Sbisson has uploaded a new change for review.

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

Change subject: Display only one foreign bundles on mobile
......................................................................

Display only one foreign bundles on mobile

Display a single foreign bundle containing both
alerts and messages on mobile.

Bug: T131683
Change-Id: I9d3d160586c31457d3a1825e9cecadde42debf7c
---
M i18n/en.json
M i18n/qqq.json
M includes/api/ApiEchoNotifications.php
M modules/ooui/mw.echo.ui.NotificationsWrapper.js
4 files changed, 8 insertions(+), 8 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Echo 
refs/changes/99/283699/1

diff --git a/i18n/en.json b/i18n/en.json
index 258e31e..d0f1f92 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -203,6 +203,7 @@
        "echo-rev-deleted-text-view": "This page revision has been suppressed.",
        "notification-header-foreign-alert": "More alerts from 
{{PLURAL:$5|another wiki|$5 other wikis}}",
        "notification-header-foreign-message": "More messages from 
{{PLURAL:$5|another wiki|$5 other wikis}}",
+       "notification-header-foreign-all": "More notifications from 
{{PLURAL:$5|another wiki|$5 other wikis}}",
        "notification-body-foreign": "$1",
        "echo-foreign-wiki-lang": "$1 - $2",
        "echo-badge-count": "{{PLURAL:$1|$1|100=99+}}",
diff --git a/i18n/qqq.json b/i18n/qqq.json
index ecfd82b..ac9bca9 100644
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -194,6 +194,7 @@
        "echo-rev-deleted-text-view": "Short message displayed instead of edit 
content when revision text is suppressed.",
        "notification-header-foreign-alert": "Flyout-specific format for 
displaying notification header of having alert notifications on foreign 
wikis.\n\nParameters:\n* $1 - the formatted username of the current user.\n* $2 
- the username for GENDER\n* $3 (deprecated) - 1 of the foreign wikis you have 
notifications on\n* $4 (deprecated) - the number of remaining other wikis you 
have notifications on\n*$5 - the number of other wikis you have notifications 
on",
        "notification-header-foreign-message": "Flyout-specific format for 
displaying notification header of having message notifications on foreign 
wikis.\n\nParameters:\n* $1 - the formatted username of the current user.\n* $2 
- the username for GENDER\n* $3 (deprecated) - 1 of the foreign wikis you have 
notifications on\n* $4 (deprecated) - the number of remaining other wikis you 
have notifications on\n*$5 - the number of other wikis you have notifications 
on",
+       "notification-header-foreign-all": "Flyout-specific format for 
displaying notification header of having notifications (combined alerts and 
messages) on foreign wikis.\n\nParameters:\n* $1 - the formatted username of 
the current user.\n* $2 - the username for GENDER\n* $3 (deprecated) - 1 of the 
foreign wikis you have notifications on\n* $4 (deprecated) - the number of 
remaining other wikis you have notifications on\n*$5 - the number of other 
wikis you have notifications on",
        "notification-body-foreign": "{{notranslate}}",
        "echo-foreign-wiki-lang": "Title of the wiki for which you're seeing 
foreign notifications:\n\nParameters:\n* $1 - the name of the site (e.g. 
'Wikipedia', 'Wikiversity', ...)\n* $2 - the language of the website (e.g. 
'English', 'Deutsch', ...)",
        "echo-badge-count": "Used only for the two Echo badges shown on the 
personal toolbar.\nParameters:\n* $1 - Formatted notification count.  However, 
for 100 or greater, 100 will be passed.",
diff --git a/includes/api/ApiEchoNotifications.php 
b/includes/api/ApiEchoNotifications.php
index c4ed7bf..9b89f6d 100644
--- a/includes/api/ApiEchoNotifications.php
+++ b/includes/api/ApiEchoNotifications.php
@@ -70,10 +70,8 @@
 
                                if ( $foreignNotifications ) {
                                        // insert fake notifications for 
foreign notifications
-                                       foreach ( $params['sections'] as $i => 
$section ) {
-                                               if ( 
$foreignNotifications->getCount( $section ) > 0 ) {
-                                                       $result['list'][-$i-1] 
= $this->makeForeignNotification( $user, $params['format'], 
$foreignNotifications, $section );
-                                               }
+                                       if ( $foreignNotifications->getCount() 
> 0 ) {
+                                               $result['list'][-1] = 
$this->makeForeignNotification( $user, $params['format'], $foreignNotifications 
);
                                        }
                                }
 
@@ -275,7 +273,7 @@
                return $result;
        }
 
-       protected function makeForeignNotification( User $user, $format, 
EchoForeignNotifications $foreignNotifications, $section ) {
+       protected function makeForeignNotification( User $user, $format, 
EchoForeignNotifications $foreignNotifications, $section = null ) {
                $wikis = $foreignNotifications->getWikis( $section );
                $count = $foreignNotifications->getCount( $section );
 
@@ -296,7 +294,7 @@
                $row->event_page_namespace = null;
                $row->event_page_title = null;
                $row->event_extra = serialize( array(
-                       'section' => $section,
+                       'section' => $section ?: 'all',
                        'wikis' => $wikis,
                        'count' => $count
                ) );
@@ -313,7 +311,7 @@
                $output = EchoDataOutputFormatter::formatOutput( $notif, 
$format, $user, $this->getLanguage() );
 
                // Add cross-wiki-specific data
-               $output['section'] = $section;
+               $output['section'] = $section ?: 'all';
                $output['count'] = $count;
                $output['sources'] = $foreignNotifications->getApiEndpoints( 
$wikis );
                // Add timestamp information
diff --git a/modules/ooui/mw.echo.ui.NotificationsWrapper.js 
b/modules/ooui/mw.echo.ui.NotificationsWrapper.js
index 87c3416..16ce20b 100644
--- a/modules/ooui/mw.echo.ui.NotificationsWrapper.js
+++ b/modules/ooui/mw.echo.ui.NotificationsWrapper.js
@@ -1,6 +1,6 @@
 ( function ( mw ) {
        /**
-        * Wapper for the notifications widget, for view outside the popup.
+        * Wrapper for the notifications widget, for view outside the popup.
         *
         * @class
         * @extends OO.ui.Widget

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9d3d160586c31457d3a1825e9cecadde42debf7c
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Echo
Gerrit-Branch: master
Gerrit-Owner: Sbisson <[email protected]>

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

Reply via email to