Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/NodeBB/NodeBB
Browse files Browse the repository at this point in the history
  • Loading branch information
barisusakli committed Jan 15, 2020
2 parents 4eb9652 + 740de03 commit 842916e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/events.js
Expand Up @@ -25,6 +25,7 @@ events.types = [
'post-delete',
'post-restore',
'post-purge',
'post-change-owner',
'topic-delete',
'topic-restore',
'topic-purge',
Expand Down
1 change: 1 addition & 0 deletions src/posts/user.js
Expand Up @@ -163,6 +163,7 @@ module.exports = function (Posts) {
reduceCounters(postsByUser),
updateTopicPosters(postData, toUid),
]);
return postData;
};

async function reduceCounters(postsByUser) {
Expand Down
13 changes: 12 additions & 1 deletion src/socket.io/posts/tools.js
Expand Up @@ -172,6 +172,17 @@ module.exports = function (SocketPosts) {
throw new Error('[[error:no-privileges]]');
}

await posts.changeOwner(data.pids, data.toUid);
var postData = await posts.changeOwner(data.pids, data.toUid);
var logs = postData.map(({ pid, uid, cid }) => (events.log({
type: 'post-change-owner',
uid: socket.uid,
ip: socket.ip,
targetUid: data.toUid,
pid: pid,
originalUid: uid,
cid: cid,
})));

await Promise.all(logs);
};
};

0 comments on commit 842916e

Please sign in to comment.