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:
22
src/feed.js
22
src/feed.js
@@ -46,17 +46,19 @@
|
|||||||
if (topicData.main_posts.length > 0) feed.pubDate = new Date(parseInt(topicData.main_posts[0].timestamp, 10)).toUTCString();
|
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++) {
|
for (var i = 0, ii = topic_posts.length; i < ii; i++) {
|
||||||
postData = topic_posts[i];
|
if (topic_posts[i].deleted === '0') {
|
||||||
dateStamp = new Date(parseInt(postData.edited === '0' ? postData.timestamp : postData.edited, 10)).toUTCString();
|
postData = topic_posts[i];
|
||||||
title = 'Reply to ' + topicData.topic_name + ' on ' + dateStamp;
|
dateStamp = new Date(parseInt(postData.edited === '0' ? postData.timestamp : postData.edited, 10)).toUTCString();
|
||||||
|
title = 'Reply to ' + topicData.topic_name + ' on ' + dateStamp;
|
||||||
|
|
||||||
feed.item({
|
feed.item({
|
||||||
title: title,
|
title: title,
|
||||||
description: postData.content,
|
description: postData.content,
|
||||||
url: nconf.get('url') + 'topic/' + topicData.slug + '#' + postData.pid,
|
url: nconf.get('url') + 'topic/' + topicData.slug + '#' + postData.pid,
|
||||||
author: postData.username,
|
author: postData.username,
|
||||||
date: dateStamp
|
date: dateStamp
|
||||||
});
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Feed.saveFeed('feeds/topics/' + tid + '.rss', feed, function(err) {
|
Feed.saveFeed('feeds/topics/' + tid + '.rss', feed, function(err) {
|
||||||
|
|||||||
@@ -11,7 +11,8 @@ var RDB = require('./redis.js'),
|
|||||||
postSearch = reds.createSearch('nodebbpostsearch'),
|
postSearch = reds.createSearch('nodebbpostsearch'),
|
||||||
topicSearch = reds.createSearch('nodebbtopicsearch'),
|
topicSearch = reds.createSearch('nodebbtopicsearch'),
|
||||||
winston = require('winston'),
|
winston = require('winston'),
|
||||||
meta = require('./meta.js');
|
meta = require('./meta.js'),
|
||||||
|
Feed = require('./feed');
|
||||||
|
|
||||||
(function(PostTools) {
|
(function(PostTools) {
|
||||||
PostTools.isMain = function(pid, tid, callback) {
|
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);
|
postSearch.index(postData.content, pid);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -749,6 +749,10 @@ var RDB = require('./redis.js')
|
|||||||
Topics.delete = function(tid) {
|
Topics.delete = function(tid) {
|
||||||
Topics.setTopicField(tid, 'deleted', 1);
|
Topics.setTopicField(tid, 'deleted', 1);
|
||||||
RDB.zrem('topics:recent', tid);
|
RDB.zrem('topics:recent', tid);
|
||||||
|
|
||||||
|
Topics.getTopicField(tid, 'cid', function(err, cid) {
|
||||||
|
feed.updateCategory(cid);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
Topics.restore = function(tid) {
|
Topics.restore = function(tid) {
|
||||||
@@ -756,6 +760,10 @@ var RDB = require('./redis.js')
|
|||||||
Topics.getTopicField(tid, 'lastposttime', function(err, lastposttime) {
|
Topics.getTopicField(tid, 'lastposttime', function(err, lastposttime) {
|
||||||
RDB.zadd('topics:recent', lastposttime, tid);
|
RDB.zadd('topics:recent', lastposttime, tid);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Topics.getTopicField(tid, 'cid', function(err, cid) {
|
||||||
|
feed.updateCategory(cid);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
Topics.reIndexTopic = function(tid, callback) {
|
Topics.reIndexTopic = function(tid, callback) {
|
||||||
|
|||||||
Reference in New Issue
Block a user