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
This commit is contained in:
Roan Kattouw 2016-03-01 17:11:27 -08:00 committed by Matthias Mullie
parent 20f091982c
commit b6625f38af
3 changed files with 9 additions and 3 deletions

View file

@ -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"
}

View file

@ -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}}",

View file

@ -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;