Bsitu has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/153529

Change subject: X on notification item to mark as read
......................................................................

X on notification item to mark as read

This will need the corresponding Flow patch: 152808

@Todo - Replace the X with a real wiki image?

Change-Id: Id643c0233e944725d6b104fc0cede2ef9a632044
---
M modules/overlay/ext.echo.overlay.js
M modules/overlay/ext.echo.overlay.less
2 files changed, 44 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Echo 
refs/changes/29/153529/1

diff --git a/modules/overlay/ext.echo.overlay.js 
b/modules/overlay/ext.echo.overlay.js
index dc25cf7..7c137b0 100644
--- a/modules/overlay/ext.echo.overlay.js
+++ b/modules/overlay/ext.echo.overlay.js
@@ -209,6 +209,19 @@
                                        // be auto makred as read
                                        if ( !data.targetpage ) {
                                                self.unreadAutoMark.push( id );
+                                       } else {
+                                               // If this notification doesn't 
have a target page,
+                                               // show the X icon to mark 
notification as read
+                                               $li.append(
+                                                       $( '<div>')
+                                                               .addClass( 
'mw-echo-unread-dismiss' )
+                                                               // @Todo - 
replace with a CSS X
+                                                               .append( 'X' )
+                                                               .click( 
function( e ) {
+                                                                       
e.preventDefault();
+                                                                       
self.manualMarkAsRead( id, $li );
+                                                               } )
+                                               );      
                                        }
                                        self.unread.push( id );
                                }
@@ -304,6 +317,29 @@
                                        }
                                } );
                        }
+               },
+               /**
+                * Manually mark a notification as read
+                * @param int Notification event id
+                * @param {JQuery} The notification container for the event id
+                * @method
+                */
+               manualMarkAsRead: function( id, $notifDiv ) {
+                       var self = this;
+
+                       this.api.postWithToken( 'edit', 
mw.echo.desktop.appendUseLang( {
+                               'action' : 'echomarkread',
+                               'list' : id
+                       } ) ).done( function ( result ) {
+                               var count;
+                               if ( result.query.echomarkread.count !== 
undefined ) {
+                                       count = result.query.echomarkread.count;
+                                       self.updateCount( count, 
result.query.echomarkread.rawcount );
+                                       // Remove the stuff for unread 
notifications
+                                       $notifDiv.removeClass( 'mw-echo-unread' 
);
+                                       $notifDiv.find( 
'.mw-echo-unread-dismiss' ).remove();
+                               }
+                       } );
                }
        };
 
diff --git a/modules/overlay/ext.echo.overlay.less 
b/modules/overlay/ext.echo.overlay.less
index 2d30df4..996b0d9 100644
--- a/modules/overlay/ext.echo.overlay.less
+++ b/modules/overlay/ext.echo.overlay.less
@@ -52,6 +52,7 @@
        }
 
        li.mw-echo-notification {
+               position: relative;
                display: block;
                padding: 0;
 
@@ -84,6 +85,13 @@
                                        background-color: #F9F9F9;
                                }
                        }
+
+                       .mw-echo-unread-dismiss {
+                               position: absolute;
+                               top: 7px;
+                               right: 7px;
+                               font-size: 20px;
+                       }
                }
 
                &:last-child {

-- 
To view, visit https://gerrit.wikimedia.org/r/153529
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id643c0233e944725d6b104fc0cede2ef9a632044
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Echo
Gerrit-Branch: master
Gerrit-Owner: Bsitu <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to