#8115 - log post owner changes (#8117)

* log post owner changes

* log each post separately

* use map instad of a loop
This commit is contained in:
Opliko
2020-01-15 17:05:57 +01:00
committed by Barış Soner Uşaklı
parent 879acc85ae
commit 740de034fa
3 changed files with 14 additions and 1 deletions

View File

@@ -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);
};
};