Skip to content

Node.js based forum software built for the modern web

closes #2762

barisusakliacc3c6a0a54c
diff --git a/public/src/client/notifications.js b/public/src/client/notifications.js
index 024fe6715c..fb778ec18f 100644
--- a/public/src/client/notifications.js
+++ b/public/src/client/notifications.js
@@ -1,10 +1,19 @@
+'use strict';
+
+/* globals define, socket, app */
+
define('forum/notifications', function() {
var Notifications = {};
Notifications.init = function() {
var listEl = $('.notifications-list');
- listEl.on('click', 'li', function(e) {
- this.querySelector('a').click();
+ listEl.on('click', 'a', function(e) {
+ var nid = $(this).parents('[data-nid]').attr('data-nid');
+ socket.emit('notifications.markRead', nid, function(err) {
+ if (err) {
+ return app.alertError(err);
+ }
+ });
});
$('span.timeago').timeago();
@@ -20,8 +29,7 @@ define('forum/notifications', function() {
listEl.empty();
});
});
-
- }
+ };
return Notifications;
});