mirror of
https://github.com/discourse/discourse.git
synced 2024-11-28 19:53:53 -06:00
FIX: Don't show the category edit button unless the user can edit the
category
This commit is contained in:
parent
c74550fbad
commit
36f081bf43
@ -28,7 +28,7 @@ export default function(filter, params) {
|
||||
category: model,
|
||||
filterMode: filterMode,
|
||||
noSubcategories: params && params.no_subcategories,
|
||||
canEditCategory: Discourse.User.currentProp('staff'),
|
||||
canEditCategory: model.get('can_edit'),
|
||||
canChangeCategoryNotificationLevel: Discourse.User.current()
|
||||
});
|
||||
},
|
||||
|
@ -66,7 +66,7 @@ Discourse.DiscoveryTopCategoryRoute = Discourse.Route.extend(Discourse.OpenCompo
|
||||
|
||||
var opts = { category: model, filterMode: filterMode };
|
||||
opts.noSubcategories = noSubcategories;
|
||||
opts.canEditCategory = Discourse.User.currentProp('staff');
|
||||
opts.canEditCategory = model.get('can_edit');
|
||||
this.controllerFor('navigation/category').setProperties(opts);
|
||||
|
||||
return Discourse.TopList.find(filterMode).then(function(list) {
|
||||
|
@ -75,7 +75,7 @@ class Site
|
||||
end
|
||||
|
||||
site = Site.new(guardian)
|
||||
MultiJson.dump(SiteSerializer.new(site, root: false))
|
||||
MultiJson.dump(SiteSerializer.new(site, root: false, scope: guardian))
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user