mirror of
https://github.com/discourse/discourse.git
synced 2025-03-22 04:15:40 +08:00
FIX: don't show Create Topic button on full search page to users who can't create topics
This commit is contained in:
parent
4270c93666
commit
bd8f8ea1f9
@ -159,9 +159,9 @@ export default Ember.Controller.extend({
|
|||||||
return this.currentUser && this.currentUser.staff && hasResults;
|
return this.currentUser && this.currentUser.staff && hasResults;
|
||||||
},
|
},
|
||||||
|
|
||||||
@computed('expanded')
|
@computed('expanded', 'model.grouped_search_result.can_create_topic')
|
||||||
canCreateTopic(expanded) {
|
canCreateTopic(expanded, userCanCreateTopic) {
|
||||||
return this.currentUser && !this.site.mobileView && !expanded;
|
return this.currentUser && userCanCreateTopic && !this.site.mobileView && !expanded;
|
||||||
},
|
},
|
||||||
|
|
||||||
@computed('expanded')
|
@computed('expanded')
|
||||||
|
@ -3,7 +3,7 @@ class GroupedSearchResultSerializer < ApplicationSerializer
|
|||||||
has_many :users, serializer: SearchResultUserSerializer
|
has_many :users, serializer: SearchResultUserSerializer
|
||||||
has_many :categories, serializer: BasicCategorySerializer
|
has_many :categories, serializer: BasicCategorySerializer
|
||||||
has_many :tags, serializer: TagSerializer
|
has_many :tags, serializer: TagSerializer
|
||||||
attributes :more_posts, :more_users, :more_categories, :term, :search_log_id, :more_full_page_results
|
attributes :more_posts, :more_users, :more_categories, :term, :search_log_id, :more_full_page_results, :can_create_topic
|
||||||
|
|
||||||
def search_log_id
|
def search_log_id
|
||||||
object.search_log_id
|
object.search_log_id
|
||||||
@ -17,4 +17,8 @@ class GroupedSearchResultSerializer < ApplicationSerializer
|
|||||||
SiteSetting.tagging_enabled
|
SiteSetting.tagging_enabled
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def can_create_topic
|
||||||
|
scope.can_create?(Topic)
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user