From 35cf44e4a67c413db297a21d83e72745b4f08129 Mon Sep 17 00:00:00 2001 From: Kaldari Date: Thu, 14 Feb 2013 14:09:56 -0800 Subject: [PATCH] (bug 45016) make sure dismiss works across all supported types Change-Id: Id9bf0c785a8fe429c6ec04c427330395d30bf68c --- modules/base/ext.echo.base.js | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/modules/base/ext.echo.base.js b/modules/base/ext.echo.base.js index a251156a4..a520c22de 100644 --- a/modules/base/ext.echo.base.js +++ b/modules/base/ext.echo.base.js @@ -5,6 +5,8 @@ 'optionsToken': '', + 'dismissOutputFormats': ['web', 'email'], + /** * Change the user's preferences related to this notification type and * reload the page. @@ -13,10 +15,19 @@ var _this = this, $notification = $( notification ), eventType = $notification.attr( 'data-notification-type' ), - change = 'echo-web-notifications' + eventType + '=0', - prefRequest = { + 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 = { 'action': 'options', - 'change': change, + 'change': prefs.join( '|' ), 'token': mw.echo.optionsToken, 'format': 'json' };