Skip to content

Commit

Permalink
keep track of the previous cid a topic was moved from
Browse files Browse the repository at this point in the history
  • Loading branch information
psychobunny committed Jul 13, 2016
1 parent 96c9832 commit 8c288f3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/topics/data.js
Expand Up @@ -78,6 +78,12 @@ module.exports = function(Topics) {
db.setObjectField('topic:' + tid, field, value, callback);
};


Topics.setTopicFields = function(tid, data, callback) {
callback = callback || function() {};
db.setObject('topic:' + tid, data, callback);
};

Topics.deleteTopicField = function(tid, field, callback) {
db.deleteObjectField('topic:' + tid, field, callback);
};
Expand Down
5 changes: 4 additions & 1 deletion src/topics/tools.js
Expand Up @@ -242,7 +242,10 @@ module.exports = function(Topics) {
categories.incrementCategoryFieldBy(cid, 'topic_count', 1, next);
},
function (next) {
Topics.setTopicField(tid, 'cid', cid, next);
Topics.setTopicFields(tid, {
cid: cid,
oldCid: oldCid
}, next);
}
], function(err) {
if (err) {
Expand Down

0 comments on commit 8c288f3

Please sign in to comment.