mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-07 06:25:50 +01:00
thread moving! (party)
This commit is contained in:
@@ -146,12 +146,6 @@ var RDB = require('./redis.js'),
|
|||||||
RDB.lpush('topics:queued:tid', tid);
|
RDB.lpush('topics:queued:tid', tid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (category_id) {
|
|
||||||
RDB.db.sadd('categories:' + category_id + ':tid', tid);
|
|
||||||
}
|
|
||||||
|
|
||||||
var slug = tid + '/' + utils.slugify(title);
|
var slug = tid + '/' + utils.slugify(title);
|
||||||
|
|
||||||
// Topic Info
|
// Topic Info
|
||||||
@@ -181,6 +175,8 @@ var RDB = require('./redis.js'),
|
|||||||
|
|
||||||
|
|
||||||
// in future it may be possible to add topics to several categories, so leaving the door open here.
|
// in future it may be possible to add topics to several categories, so leaving the door open here.
|
||||||
|
RDB.db.sadd('categories:' + category_id + ':tid', tid);
|
||||||
|
RDB.set('tid:' + tid + ':cid', category_id);
|
||||||
categories.get_category([category_id], function(data) {
|
categories.get_category([category_id], function(data) {
|
||||||
RDB.set('tid:' + tid + ':category_name', data.categories[0].name);
|
RDB.set('tid:' + tid + ':category_name', data.categories[0].name);
|
||||||
RDB.set('tid:' + tid + ':category_slug', data.categories[0].slug);
|
RDB.set('tid:' + tid + ':category_slug', data.categories[0].slug);
|
||||||
@@ -288,8 +284,19 @@ var RDB = require('./redis.js'),
|
|||||||
}
|
}
|
||||||
|
|
||||||
Topics.move = function(tid, cid, socket) {
|
Topics.move = function(tid, cid, socket) {
|
||||||
moved = true; // nibstayla
|
RDB.get('tid:' + tid + ':cid', function(oldCid) {
|
||||||
if (moved) socket.emit('api:topic.move', { status: 'ok' });
|
RDB.db.smove('categories:' + oldCid + ':tid', 'categories:' + cid + ':tid', tid, function(err, result) {
|
||||||
else socket.emit('api:topic.move', { status: 'error' });
|
if (!err && result === 1) {
|
||||||
|
RDB.set('tid:' + tid + ':cid', cid);
|
||||||
|
categories.get_category([cid], function(data) {
|
||||||
|
RDB.set('tid:' + tid + ':category_name', data.categories[0].name);
|
||||||
|
RDB.set('tid:' + tid + ':category_slug', data.categories[0].slug);
|
||||||
|
});
|
||||||
|
socket.emit('api:topic.move', { status: 'ok' });
|
||||||
|
} else {
|
||||||
|
socket.emit('api:topic.move', { status: 'error' });
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}(exports));
|
}(exports));
|
||||||
Reference in New Issue
Block a user