mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Echo
synced 2024-11-30 18:45:07 +00:00
(bug 45016) make sure dismiss works across all supported types
Change-Id: Id9bf0c785a8fe429c6ec04c427330395d30bf68c
This commit is contained in:
parent
3ced897d18
commit
35cf44e4a6
|
@ -5,6 +5,8 @@
|
||||||
|
|
||||||
'optionsToken': '',
|
'optionsToken': '',
|
||||||
|
|
||||||
|
'dismissOutputFormats': ['web', 'email'],
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change the user's preferences related to this notification type and
|
* Change the user's preferences related to this notification type and
|
||||||
* reload the page.
|
* reload the page.
|
||||||
|
@ -13,10 +15,19 @@
|
||||||
var _this = this,
|
var _this = this,
|
||||||
$notification = $( notification ),
|
$notification = $( notification ),
|
||||||
eventType = $notification.attr( 'data-notification-type' ),
|
eventType = $notification.attr( 'data-notification-type' ),
|
||||||
change = 'echo-web-notifications' + eventType + '=0',
|
prefName = '',
|
||||||
|
prefs = [],
|
||||||
|
prefRequest = {};
|
||||||
|
$.each( mw.echo.dismissOutputFormats, function( index, format ) {
|
||||||
|
// Make sure output format pref exists for this event type
|
||||||
|
prefName = 'echo-' + format + '-notifications' + eventType;
|
||||||
|
if ( mw.user.options.exists( prefName ) ) {
|
||||||
|
prefs.push( prefName + '=0' );
|
||||||
|
}
|
||||||
|
} );
|
||||||
prefRequest = {
|
prefRequest = {
|
||||||
'action': 'options',
|
'action': 'options',
|
||||||
'change': change,
|
'change': prefs.join( '|' ),
|
||||||
'token': mw.echo.optionsToken,
|
'token': mw.echo.optionsToken,
|
||||||
'format': 'json'
|
'format': 'json'
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue