Merge "Fixing dismiss functionality for new checkmatrix system and categories"

This commit is contained in:
Bsitu 2013-03-07 23:21:29 +00:00 committed by Gerrit Code Review
commit 18f9b513d2
5 changed files with 9 additions and 7 deletions

View file

@ -102,6 +102,7 @@ class ApiEchoNotifications extends ApiQueryBase {
$thisEvent = array(
'id' => $event->getId(),
'type' => $event->getType(),
'category' => EchoNotificationController::getNotificationCategory( $event->getType() ),
'timestamp' => array(
'unix' => $timestampUnix,
'mw' => $timestampMw,

View file

@ -14,13 +14,13 @@
'dismiss': function( notification ) {
var _this = this,
$notification = $( notification ),
eventType = $notification.attr( 'data-notification-type' ),
eventCategory = $notification.attr( 'data-notification-category' ),
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;
prefName = 'echo-subscriptions-' + format + '-' + eventCategory;
if ( mw.user.options.exists( prefName ) ) {
prefs.push( prefName + '=0' );
}
@ -43,8 +43,8 @@
{
window.location.reload();
} else {
eventType = $notification.attr( 'data-notification-type' );
$( '.mw-echo-overlay li[data-notification-type="' + eventType + '"]' ).hide();
eventCategory = $notification.attr( 'data-notification-category' );
$( '.mw-echo-overlay li[data-notification-category="' + eventCategory + '"]' ).hide();
$notification.data( 'dismiss', false );
}
},

View file

@ -61,7 +61,7 @@
var $li = $( '<li></li>' )
.data( 'details', data )
.data( 'id', id )
.attr( 'data-notification-type', data.type )
.attr( 'data-notification-category', data.category )
.addClass( 'mw-echo-notification' )
.append( data['*'] )
.appendTo( $ul );

View file

@ -80,7 +80,7 @@
.data( 'details', data )
.data( 'id', id )
.addClass( 'mw-echo-notification' )
.attr( 'data-notification-type', data.type )
.attr( 'data-notification-category', data.category )
.append( data['*'] )
.appendTo( container );

View file

@ -79,7 +79,8 @@ class SpecialNotifications extends SpecialPage {
}
$nextTimestamp = $row['timestamp']['unix'];
$nextOffset = $row['id'];
$notices .= Html::rawElement( 'li', array( 'class' => $class, 'data-notification-type' => $row['type'] ), $row['*'] );
$dataNotificationCategory = EchoNotificationController::getNotificationCategory( $row['type'] );
$notices .= Html::rawElement( 'li', array( 'class' => $class, 'data-notification-category' => $dataNotificationCategory ), $row['*'] );
}
$html .= Html::rawElement( 'ul', array( 'id' => 'mw-echo-special-container' ), $notices );