mirror of
https://github.com/discourse/discourse-solved.git
synced 2025-05-26 01:49:15 +00:00
A while ago the `accept_all_solutions_allowed_groups` setting was introduced to replace the `accept_all_solutions_trust_level` setting and to make the plugin more flexible by allowing admins to choose groups that are allowed to accept solutions instead of trust levels.
The new group-based setting includes the TL4 group by default. However, removing the TL4 group from the setting doesn't actually remove TL4 users permission to accept solution.
The reason for this bug is that the `can_accept_answer?` guardian method calls `can_perform_action_available_to_group_moderators?` which always allows TL4 users to perform category moderator actions:
56524f4bdf/lib/guardian/topic_guardian.rb (L342-L348)
This commit fixes the bug by checking if the user is a moderator on the topic's category (by calling the `is_category_group_moderator?` guardian method) instead of checking if the user can perform category moderator actions. In our case, `is_category_group_moderator?` is equivalent to `can_perform_action_available_to_group_moderators?` except for the TL4 check which is what we need.
Internal topic: t/134675.
Discourse Solved
Provides a solved button on designated categories
How to Install this Plugin
To install Discourse Plugin - https://meta.discourse.org/t/install-a-plugin/19157
How to Check if Plugin is installed
Go to Admin > Plugins
You should now see:
What to expect if Plugin is installed
Inside the Plugins, you will have the following options:
How to enable it in your posts
New Categories - Check ✅ Allow topic owner and staff to mark a reply as the solution
Old Categories - Go to that Category > Edit > Settings > Check ✅ Allow topic owner and staff to mark a reply as the solution
BONUS: How to add badges to those who answered correctly
https://meta.discourse.org/t/discourse-solved-accepted-answer-plugin/30155
License
MIT
Description
Languages
Ruby
73.8%
JavaScript
22.8%
Handlebars
1.8%
SCSS
1.6%