mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Echo
synced 2024-11-12 01:10:07 +00:00
Handle the missing 'all' type as specified in the doc
The text for 'type' in the documentation of the parent describes the notification type can be 'all', following 'message' and 'alert'. That is actually used, for instance inside of mw.echo.Controller.markLocalNotificationsRead() function. The gap between doc and implementation results in bugs. This resolves the gap. Bug: T270879 Change-Id: I546aa42e927a05a5426db90153901ae632b97e36
This commit is contained in:
parent
1a44500829
commit
5943b13b5b
|
@ -55,12 +55,18 @@
|
|||
* @inheritdoc
|
||||
*/
|
||||
mw.echo.api.LocalAPIHandler.prototype.markAllRead = function ( source, type ) {
|
||||
var data;
|
||||
type = Array.isArray( type ) ? type : [ type ];
|
||||
data = {
|
||||
action: 'echomarkread',
|
||||
sections: type.join( '|' )
|
||||
var data = {
|
||||
action: 'echomarkread'
|
||||
};
|
||||
type = Array.isArray( type ) ? type : [ type ];
|
||||
if ( type.indexOf( 'all' ) !== -1 ) {
|
||||
// As specified in the documentation of the parent function, the type parameter can be
|
||||
// 'all'. We especially handle that case here to match the PHP API. Note: Other values
|
||||
// of the array will be ignored.
|
||||
data.all = true;
|
||||
} else {
|
||||
data.sections = type.join( '|' );
|
||||
}
|
||||
if ( !this.isSourceLocal( source ) ) {
|
||||
data.wikis = source;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue