-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enabled Topic Owners to properly delete posts in their topic #20
Conversation
… can delete posts in their topic. modified socket.io/posts/tools.js to not display admin positions along with topic owner position
Your PR looks good but your code appears to be failing some of the lint tests. I would recommend making the changes suggested by the linter but otherwise looks good. |
Pull Request Test Coverage Report for Build 13557533598Warning: This coverage report may be inaccurate.This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.
Details
💛 - Coveralls |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good now that the lint errors were fixed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PR looks good. The only thing I would check is the merge conflict still present in nodebb-theme-harmony/templates/topic.tpl. Besides this, the code looks good, and all lint tests are passing, so it looks ready to go.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now that the merge conflicts are resolved, everything looks good!
Context
Topic Owners could see the delete option on posts under their topic/thread but upon clicking the delete button, they would not have the permissions to delete and so the action would fail.
Description
Now, when a topic owner selects a post, the post will be marked as deleted and have all the attributes of a deleted post.
File Changes
src/socket.io/posts/tools.js
Updated the display permissions to display admin or moderator post options only if the user is an admin or moderator and not just if they have edit or delete permissions
src/privileges/posts.js
Under the privPosts.canDelete function, added a variable to check if the user is a topic owner and modified the flag to also be true if the user is the topic owner.
test/posts.js
Added set up and test case to see a topic Owner has the permission/privilege to delete posts under their topic.
Testing
Verified changes on the front end. Topic owner was able to successfully delete posts and did not have admin permissions.
Verified back end changes worked properly through test cases in test/posts.js