mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FEATURE: Allow Category Group Moderators to edit topic titles (#11340)
* FEATURE: Allow Category Group Moderators to edit topic titles Adds category group moderators to the topic guardian’s `can_edit` method. The value of `can_edit` is returned by the topic view serializer, and this value determines whether the current user can edit the title/category/tags of the topic directly (which category group moderators could already do by editing the first post of a topic). Note that the value of `can_edit` is now always returned by the topic view serializer (ie, for both true and false values) to cover the case where a topic is moved out of a category that a category group moderator has permissions on, so that when the topic is reloaded the UI picks up that `can_edit` is now false, and thus the edit icon should no longer be displayed. * DEV: Add a comment explaining why `can_edit` is always returned
This commit is contained in:
@@ -79,6 +79,7 @@ module TopicGuardian
|
||||
|
||||
return true if is_admin?
|
||||
return true if is_moderator? && can_create_post?(topic)
|
||||
return true if is_category_group_moderator?(topic.category)
|
||||
|
||||
# can't edit topics in secured categories where you don't have permission to create topics
|
||||
# except for a tiny edge case where the topic is uncategorized and you are trying
|
||||
|
||||
Reference in New Issue
Block a user