FIX: create topic keyboard shortcut not checking permissions

This commit is contained in:
Sam 2017-12-21 11:23:45 +11:00
parent e17ce65aab
commit e756d02088
2 changed files with 9 additions and 2 deletions

View File

@ -169,7 +169,9 @@ export default {
},
createTopic() {
this.container.lookup('controller:composer').open({action: Composer.CREATE_TOPIC, draftKey: Composer.CREATE_TOPIC});
if (this.currentUser && this.currentUser.can_create_topic) {
this.container.lookup('controller:composer').open({action: Composer.CREATE_TOPIC, draftKey: Composer.CREATE_TOPIC});
}
},
pinUnpinTopic() {

View File

@ -38,7 +38,12 @@ class CurrentUserSerializer < BasicUserSerializer
:previous_visit_at,
:seen_notification_id,
:primary_group_id,
:primary_group_name
:primary_group_name,
:can_create_topic
def can_create_topic
scope.can_create_topic?(nil)
end
def include_site_flagged_posts_count?
object.staff?