Skip to content

Commit

Permalink
fix: incorrect logic for post history editable bool
Browse files Browse the repository at this point in the history
  • Loading branch information
julianlam committed Oct 20, 2020
1 parent 205a103 commit a691be5
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/socket.io/posts/diffs.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,13 @@ module.exports = function (SocketPosts) {
let usernames = await user.getUsersFields(uids, ['username']);
usernames = usernames.map(userObj => (userObj.uid ? userObj.username : null));

const cid = await posts.getCidByPid(data.pid);
const canEdit = await privileges.categories.can('posts:edit', cid, socket.uid);
let canEdit = true;
try {
await user.isPrivilegedOrSelf(socket.uid, post.uid);
} catch (e) {
canEdit = false;
}

timestamps.push(post.timestamp);

return {
Expand Down

0 comments on commit a691be5

Please sign in to comment.