Skip to content

Node.js based forum software built for the modern web

fix: incorrect logic for post history editable bool

Julian Lama691be595216
diff --git a/src/socket.io/posts/diffs.js b/src/socket.io/posts/diffs.js
index 3a5f2d6a6b..fb74f6a9ef 100644
--- a/src/socket.io/posts/diffs.js
+++ b/src/socket.io/posts/diffs.js
@@ -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 {