Skip to content
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

FIX: Hide delete button if user cannot delete and/or flag a post #11045

Merged
merged 2 commits into from
Oct 27, 2020

Conversation

jbrw
Copy link
Contributor

@jbrw jbrw commented Oct 27, 2020

If a user has a trust level lower than the SiteSetting min_trust_to_flag_posts, they may not be able to flag posts. If so, don't show them the prompt suggesting they flag a post.

@@ -377,7 +377,7 @@ registerButton("delete", (attrs) => {
icon: "far-trash-alt",
className: "delete",
};
} else if (attrs.showFlagDelete) {
} else if (attrs.showFlagDelete && attrs.canFlag) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe the canFlag check can be in lib/transform-post.js, where showFlagDelete is set?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch!

@jbrw jbrw merged commit 35cfca1 into master Oct 27, 2020
@jbrw jbrw deleted the hide-post-delete-button branch October 27, 2020 17:02
@discoursebot
Copy link

This pull request has been mentioned on Discourse Meta. There might be relevant details there:

https://meta.discourse.org/t/new-user-cant-flag-delete-a-post/167443/10

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants