mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-01-06 07:40:43 +01:00
if source has no parentCid assume 0
This commit is contained in:
@@ -149,12 +149,13 @@ module.exports = function (Categories) {
|
||||
|
||||
var tasks = [];
|
||||
|
||||
if (copyParent && utils.isNumber(destination.parentCid)) {
|
||||
tasks.push(async.apply(db.sortedSetRemove, 'cid:' + destination.parentCid + ':children', toCid));
|
||||
const oldParent = parseInt(destination.parentCid, 10) || 0;
|
||||
const newParent = parseInt(results.source.parentCid, 10) || 0;
|
||||
if (copyParent) {
|
||||
tasks.push(async.apply(db.sortedSetRemove, 'cid:' + oldParent + ':children', toCid));
|
||||
}
|
||||
|
||||
if (copyParent && utils.isNumber(results.source.parentCid)) {
|
||||
tasks.push(async.apply(db.sortedSetAdd, 'cid:' + results.source.parentCid + ':children', results.source.order, toCid));
|
||||
if (copyParent) {
|
||||
tasks.push(async.apply(db.sortedSetAdd, 'cid:' + newParent + ':children', results.source.order, toCid));
|
||||
}
|
||||
|
||||
destination.description = results.source.description;
|
||||
|
||||
Reference in New Issue
Block a user