mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Echo
synced 2024-11-28 01:30:15 +00:00
Fixing dismiss functionality for new checkmatrix system and categories
Change-Id: I3b64c4853587d4d2d8f04fc97c9b3ddb15b520ed
This commit is contained in:
parent
8252026040
commit
fcb5d99b37
|
@ -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,
|
||||
|
|
|
@ -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 );
|
||||
}
|
||||
},
|
||||
|
|
|
@ -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 );
|
||||
|
|
|
@ -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 );
|
||||
|
||||
|
|
|
@ -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 );
|
||||
|
||||
|
|
Loading…
Reference in a new issue