From 71482163ed1a0ddf6aaa7900eaf5d5edf86f78f8 Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Thu, 16 May 2013 10:59:45 -0400 Subject: [PATCH] updating post and topic methods so that when you reply to a post or create a new topic, that topic isn't flagged as unread for you --- src/posts.js | 3 +++ src/topics.js | 1 + 2 files changed, 4 insertions(+) diff --git a/src/posts.js b/src/posts.js index 1a9eedacfc..e14f67e889 100644 --- a/src/posts.js +++ b/src/posts.js @@ -168,6 +168,9 @@ marked.setOptions({ RDB.del('tid:' + tid + ':read_by_uid'); // let everybody know there is an unread post + // Re-add the poster, so he/she does not get an "unread" flag on this topic + topics.markAsRead(tid, uid); + socket.emit('event:alert', { title: 'Reply Successful', message: 'You have successfully replied. Click here to view your reply.', diff --git a/src/topics.js b/src/topics.js index 69f79e7d83..ead41792d1 100644 --- a/src/topics.js +++ b/src/topics.js @@ -215,6 +215,7 @@ var RDB = require('./redis.js'), if (pid > 0) RDB.lpush('tid:' + tid + ':posts', pid); }); + Topics.markAsRead(tid, uid); // User Details - move this out later RDB.lpush('uid:' + uid + ':topics', tid);