teaser fixes

if a post is deleted/restored update the teaser to the latest undeleted
pid, if all posts are deleted it will be set to null
This commit is contained in:
Barış Soner Uşaklı
2015-04-16 13:23:21 -04:00
parent edb856ba90
commit e7dd881092
3 changed files with 29 additions and 13 deletions

View File

@@ -33,6 +33,9 @@ module.exports = function(Posts) {
},
function(next) {
Posts.dismissFlag(pid, next);
},
function(next) {
topics.updateTeaser(postData.tid, next);
}
], function(err) {
callback(err, postData);
@@ -64,6 +67,9 @@ module.exports = function(Posts) {
},
function(next) {
db.sortedSetAdd('cid:' + cid + ':pids', postData.timestamp, pid, next);
},
function(next) {
topics.updateTeaser(postData.tid, next);
}
], function(err) {
callback(err, postData);