Skip to content

Node.js based forum software built for the modern web

closes #4101

barisusakli2b5f9d075b91
diff --git a/public/language/en_GB/topic.json b/public/language/en_GB/topic.json
index 26cf968245..78513c5256 100644
--- a/public/language/en_GB/topic.json
+++ b/public/language/en_GB/topic.json
@@ -43,6 +43,7 @@
"markAsUnreadForAll.success" : "Topic marked as unread for all.",
"mark_unread": "Mark unread",
+ "mark_unread.success": "Topic marked as unread.",
"watch": "Watch",
"unwatch": "Unwatch",
diff --git a/public/src/client/topic/threadTools.js b/public/src/client/topic/threadTools.js
index c954ae884d..7b5b9605f7 100644
--- a/public/src/client/topic/threadTools.js
+++ b/public/src/client/topic/threadTools.js
@@ -54,7 +54,12 @@ define('forum/topic/threadTools', [
});
topicContainer.on('click', '[component="topic/mark-unread"]', function() {
- socket.emit('topics.markUnread', tid);
+ socket.emit('topics.markUnread', tid, function(err) {
+ if (err) {
+ return app.alertError(err);
+ }
+ app.alertSuccess('[[topic:mark_unread.success]]');
+ });
return false;
});
diff --git a/src/socket.io/topics/unread.js b/src/socket.io/topics/unread.js
index 3af0c811d7..57eeb7958d 100644
--- a/src/socket.io/topics/unread.js
+++ b/src/socket.io/topics/unread.js
@@ -56,7 +56,7 @@ module.exports = function(SocketTopics) {
SocketTopics.markUnread = function(socket, tid, callback) {
if (!tid || !socket.uid) {
- return callback();
+ return callback(new Error('[[error:invalid-data]]'));
}
topics.markUnread(tid, socket.uid, function(err) {
if (err) {
@@ -64,6 +64,7 @@ module.exports = function(SocketTopics) {
}
topics.pushUnreadCount(socket.uid);
+ callback();
});
};