v1.18.x
barisusakli 10 years ago
parent 9c7c87fd3b
commit b2fad172e5

@ -39,12 +39,15 @@ define('notifications', ['sounds', 'translator'], function(sound, translator) {
}); });
notifList.on('click', '[data-nid]', function() { notifList.on('click', '[data-nid]', function() {
var nid = this.getAttribute('data-nid'); var unread = $(this).hasClass('unread');
if (!unread) {
socket.emit('notifications.markRead', nid, function(err) { return;
}
socket.emit('notifications.markRead', $(this).attr('data-nid'), function(err) {
if (err) { if (err) {
app.alertError(err.message); return app.alertError(err.message);
} }
increaseNotifCount(-1);
}); });
}); });
@ -58,14 +61,13 @@ define('notifications', ['sounds', 'translator'], function(sound, translator) {
}); });
notifList.on('click', '.mark-read', function(e) { notifList.on('click', '.mark-read', function(e) {
var liEl = $(this.parentNode), var liEl = $(this).parent(),
nid = liEl.attr('data-nid'),
unread = liEl.hasClass('unread'); unread = liEl.hasClass('unread');
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();
socket.emit('notifications.mark' + (unread ? 'Read' : 'Unread'), nid, function(err) { socket.emit('notifications.mark' + (unread ? 'Read' : 'Unread'), liEl.attr('data-nid'), function(err) {
if (err) { if (err) {
app.alertError(err.message); app.alertError(err.message);
} }

Loading…
Cancel
Save