mirror of
https://github.com/discourse/discourse.git
synced 2025-06-01 09:08:10 +08:00
FIX: Don't show the category edit button unless the user can edit the
category
This commit is contained in:
@ -14,7 +14,8 @@ class BasicCategorySerializer < ApplicationSerializer
|
||||
:parent_category_id,
|
||||
:notification_level,
|
||||
:logo_url,
|
||||
:background_url
|
||||
:background_url,
|
||||
:can_edit
|
||||
|
||||
def include_parent_category_id?
|
||||
parent_category_id
|
||||
@ -23,4 +24,12 @@ class BasicCategorySerializer < ApplicationSerializer
|
||||
def description
|
||||
object.uncategorized? ? SiteSetting.uncategorized_description : object.description
|
||||
end
|
||||
|
||||
def can_edit
|
||||
true
|
||||
end
|
||||
def include_can_edit?
|
||||
scope && scope.can_edit?(object)
|
||||
end
|
||||
|
||||
end
|
||||
|
Reference in New Issue
Block a user