Node.js based forum software built for the modern web
when a post is restored update topic timestamp
Baris Soner Usaklif7291631d8cd
diff --git a/src/postTools.js b/src/postTools.jsindex 094d149707..6434a3cc22 100644--- a/src/postTools.js+++ b/src/postTools.js@@ -81,7 +81,7 @@ marked.setOptions({}PostTools.delete = function(uid, pid) {- var success = function() {+ var success = function() {posts.setPostField(pid, 'deleted', 1);@@ -116,7 +116,7 @@ marked.setOptions({}PostTools.restore = function(uid, pid) {- var success = function() {+ var success = function() {posts.setPostField(pid, 'deleted', 0);posts.getPostFields(pid, ['tid', 'uid'], function(postData) {@@ -126,6 +126,12 @@ marked.setOptions({io.sockets.in('topic_' + postData.tid).emit('event:post_restored', {pid: pid});++ threadTools.get_latest_undeleted_pid(postData.tid, function(err, pid) {+ posts.getPostField(pid, 'timestamp', function(timestamp) {+ topics.updateTimestamp(postData.tid, timestamp);+ });+ });});};diff --git a/src/posts.js b/src/posts.jsindex 5a09ff0df8..b4e07be059 100644--- a/src/posts.js+++ b/src/posts.js@@ -298,7 +298,6 @@ marked.setOptions({});topics.increasePostCount(tid);- topics.setTopicField(tid, 'lastposttime', timestamp);topics.updateTimestamp(tid, timestamp);RDB.incr('totalpostcount');diff --git a/src/topics.js b/src/topics.jsindex a7c37f7cde..773c91bf47 100644--- a/src/topics.js+++ b/src/topics.js@@ -452,6 +452,7 @@ marked.setOptions({Topics.updateTimestamp = function(tid, timestamp) {RDB.zadd(schema.topics().recent, timestamp, tid);+ Topics.setTopicField(tid, 'lastposttime', timestamp);}}(exports));\ No newline at end of file