Commit Graph

8 Commits

Author SHA1 Message Date
Osama Sayegh 187b8bf19d
FIX: Support multiple moderation groups on category (#307)
See relevant core PR: https://github.com/discourse/discourse/pull/28655.
2024-09-04 04:37:17 +03:00
Osama Sayegh 77c07edf82
FIX: Don't allow TL4 users to unconditionally accept solutions (#305)
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.
2024-08-09 14:59:28 +03:00
Martin Brennan 444dac8a9a
DEV: Change accept_all_solutions_trust_level to group setting (#276)
This refactor makes for easier testing and makes things
more organised, the guardian extensions had no testing
whatsoever and I need some to make the TL -> group change.
2024-01-23 11:45:32 +10:00
Krzysztof Kotlarek 5c84152b06
DEV: Replace deprecated min_trust_to_create_post (#272)
In https://github.com/discourse/discourse/pull/24740, `min_trust_to_create_topic` site setting was replaced by `create_topic_allowed_groups`. This PR replaces the former, deprecated one, with the latter.
2023-12-14 13:28:50 +11:00
David Taylor 14e0800a29
DEV: Introduce syntax_tree for ruby formatting (#217) 2022-12-23 20:36:08 +00:00
Martin Brennan 76daa65b11
DEV: Fix specs for personal_message_enabled_groups setting (#208)
See https://github.com/discourse/discourse/pull/18437,
we are removing any references to enable_personal_messages
in core and using only personal_message_enabled_groups,
which requires auto groups to be assigned in certain specs
for them to keep working.
2022-10-04 14:19:45 +10:00
David Taylor 9cb67f6706
DEV: Bump rubocop-discourse (#207)
* DEV: Bump rubocop-discourse

* Fix rubocop violations
2022-10-03 22:21:31 +02:00
Joffrey JAFFEUX 9b8aa09855
DEV: adds an automation script for first accepted solution (#172) 2021-11-12 16:00:48 +01:00