From b6625f38afd1e58e7f7ce1a5f69e6d3a0849f4c0 Mon Sep 17 00:00:00 2001 From: Roan Kattouw Date: Tue, 1 Mar 2016 17:11:27 -0800 Subject: [PATCH] Add unreadfirst parameter that works in non-groupbysection mode It's terrible that in groupbysection mode, you still have to pass messageunreadfirst and alertunreadfirst separately, but at least this way the unreadfirst feature is available at all in the non-grouped mode. Change-Id: Ifb0707be484bda8e33810c888bae1d008cac2d9f --- i18n/en.json | 5 +++-- i18n/qqq.json | 1 + includes/api/ApiEchoNotifications.php | 6 +++++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/i18n/en.json b/i18n/en.json index a7fac9859..eadb4ec8e 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -186,9 +186,10 @@ "apihelp-query+notifications-param-index": "If specified, a list of notification IDs, in order, will be returned.", "apihelp-query+notifications-param-noforn": "True to opt out of data about notifications on foreign wikis.", "apihelp-query+notifications-param-alertcontinue": "When more alert results are available, use this to continue.", - "apihelp-query+notifications-param-alertunreadfirst": "Whether to show unread message notifications first.", + "apihelp-query+notifications-param-unreadfirst": "Whether to show unread notifications first (only used if groupbysection is not set).", + "apihelp-query+notifications-param-alertunreadfirst": "Whether to show unread message notifications first (only used if groupbysection is set).", "apihelp-query+notifications-param-messagecontinue": "When more message results are available, use this to continue.", - "apihelp-query+notifications-param-messageunreadfirst": "Whether to show unread alert notifications first.", + "apihelp-query+notifications-param-messageunreadfirst": "Whether to show unread alert notifications first (only used if groupbysection is set).", "apihelp-query+notifications-example-1": "List notifications", "apihelp-query+notifications-example-2": "List notifications, grouped by section, with counts" } diff --git a/i18n/qqq.json b/i18n/qqq.json index c94582b6f..0fb3e7822 100644 --- a/i18n/qqq.json +++ b/i18n/qqq.json @@ -206,6 +206,7 @@ "apihelp-query+notifications-param-limit": "{{doc-apihelp-param|query+notifications|limit}}", "apihelp-query+notifications-param-index": "{{doc-apihelp-param|query+notifications|index}}", "apihelp-query+notifications-param-noforn": "{{doc-apihelp-param|query+notifications|noforn}}", + "apihelp-query+notifications-param-unreadfirst": "{{doc-apihelp-param|query+notifications|unreadfirst}}", "apihelp-query+notifications-param-alertcontinue": "{{doc-apihelp-param|query+notifications|alertcontinue}}", "apihelp-query+notifications-param-alertunreadfirst": "{{doc-apihelp-param|query+notifications|alertunreadfirst}}", "apihelp-query+notifications-param-messagecontinue": "{{doc-apihelp-param|query+notifications|messagecontinue}}", diff --git a/includes/api/ApiEchoNotifications.php b/includes/api/ApiEchoNotifications.php index e3caaed79..230e8678a 100644 --- a/includes/api/ApiEchoNotifications.php +++ b/includes/api/ApiEchoNotifications.php @@ -65,7 +65,7 @@ class ApiEchoNotifications extends ApiQueryBase { $result = $this->getPropList( $user, $attributeManager->getUserEnabledEventsbySections( $user, 'web', $params['sections'] ), - $params['filter'], $params['limit'], $params['continue'], $params['format'] + $params['filter'], $params['limit'], $params['continue'], $params['format'], $params['unreadfirst'] ); if ( $foreignNotifications ) { @@ -368,6 +368,10 @@ class ApiEchoNotifications extends ApiQueryBase { 'continue' => array( ApiBase::PARAM_HELP_MSG => 'api-help-param-continue', ), + 'unreadfirst' => array( + ApiBase::PARAM_TYPE => 'boolean', + ApiBase::PARAM_DFLT => false, + ), ); foreach ( $sections as $section ) { $params[$section . 'continue'] = null;