mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-29 10:06:13 +01:00
Change post owner (#7752)
* feat: #7749, allow array of keys for setObject * feat: sortedSetRemoveBulk * feat: test for bulk remove * feat: #7083, ability to change post ownership * feat: #7083, fix tid:<tid>:posters * feat: #7083, front end * fix: #7752, psql methods * fix: add missing await * fix: maybe psql
This commit is contained in:
committed by
GitHub
parent
5b746d53e7
commit
53e1b349ae
@@ -248,4 +248,16 @@ module.exports = function (SocketPosts) {
|
||||
},
|
||||
}, callback);
|
||||
}
|
||||
|
||||
SocketPosts.changeOwner = async function (socket, data) {
|
||||
if (!data || !Array.isArray(data.pids) || !data.toUid) {
|
||||
throw new Error('[[error:invalid-data]]');
|
||||
}
|
||||
const isAdminOrGlobalMod = user.isAdminOrGlobalMod(socket.uid);
|
||||
if (!isAdminOrGlobalMod) {
|
||||
throw new Error('[[error:no-privileges]]');
|
||||
}
|
||||
|
||||
await posts.changeOwner(data.pids, data.toUid);
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user