mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-08 06:55:46 +01:00
deleting and restoring posts and topics now update the corresponding RSS feeds
fixed #257
This commit is contained in:
@@ -46,6 +46,7 @@
|
||||
if (topicData.main_posts.length > 0) feed.pubDate = new Date(parseInt(topicData.main_posts[0].timestamp, 10)).toUTCString();
|
||||
|
||||
for (var i = 0, ii = topic_posts.length; i < ii; i++) {
|
||||
if (topic_posts[i].deleted === '0') {
|
||||
postData = topic_posts[i];
|
||||
dateStamp = new Date(parseInt(postData.edited === '0' ? postData.timestamp : postData.edited, 10)).toUTCString();
|
||||
title = 'Reply to ' + topicData.topic_name + ' on ' + dateStamp;
|
||||
@@ -58,6 +59,7 @@
|
||||
date: dateStamp
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Feed.saveFeed('feeds/topics/' + tid + '.rss', feed, function(err) {
|
||||
if (callback) callback();
|
||||
|
||||
@@ -11,7 +11,8 @@ var RDB = require('./redis.js'),
|
||||
postSearch = reds.createSearch('nodebbpostsearch'),
|
||||
topicSearch = reds.createSearch('nodebbtopicsearch'),
|
||||
winston = require('winston'),
|
||||
meta = require('./meta.js');
|
||||
meta = require('./meta.js'),
|
||||
Feed = require('./feed');
|
||||
|
||||
(function(PostTools) {
|
||||
PostTools.isMain = function(pid, tid, callback) {
|
||||
@@ -138,6 +139,8 @@ var RDB = require('./redis.js'),
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
Feed.updateTopic(postData.tid);
|
||||
});
|
||||
};
|
||||
|
||||
@@ -174,6 +177,8 @@ var RDB = require('./redis.js'),
|
||||
}
|
||||
});
|
||||
|
||||
Feed.updateTopic(postData.tid);
|
||||
|
||||
postSearch.index(postData.content, pid);
|
||||
});
|
||||
};
|
||||
|
||||
@@ -749,6 +749,10 @@ var RDB = require('./redis.js')
|
||||
Topics.delete = function(tid) {
|
||||
Topics.setTopicField(tid, 'deleted', 1);
|
||||
RDB.zrem('topics:recent', tid);
|
||||
|
||||
Topics.getTopicField(tid, 'cid', function(err, cid) {
|
||||
feed.updateCategory(cid);
|
||||
});
|
||||
}
|
||||
|
||||
Topics.restore = function(tid) {
|
||||
@@ -756,6 +760,10 @@ var RDB = require('./redis.js')
|
||||
Topics.getTopicField(tid, 'lastposttime', function(err, lastposttime) {
|
||||
RDB.zadd('topics:recent', lastposttime, tid);
|
||||
});
|
||||
|
||||
Topics.getTopicField(tid, 'cid', function(err, cid) {
|
||||
feed.updateCategory(cid);
|
||||
});
|
||||
}
|
||||
|
||||
Topics.reIndexTopic = function(tid, callback) {
|
||||
|
||||
Reference in New Issue
Block a user