FIX: Popup menu not showing for non-staff users.

This commit is contained in:
Guo Xiang Tan 2016-06-17 10:10:05 +08:00
parent fde5ef4902
commit ddfb798276
No known key found for this signature in database
GPG key ID: 19C321C8952B0F72
3 changed files with 8 additions and 3 deletions

View file

@ -419,7 +419,7 @@ export default Ember.Component.extend({
sendAction: 'showUploadModal' sendAction: 'showUploadModal'
}); });
if (this.get("popupMenuOptions").some(option => option.condition)) { if (this.get("showPopupMenu")) {
toolbar.addButton({ toolbar.addButton({
id: 'options', id: 'options',
group: 'extras', group: 'extras',

View file

@ -111,6 +111,11 @@ export default Ember.Controller.extend({
return currentUser && currentUser.get('staff') && this.siteSettings.enable_whispers && action === Composer.REPLY; return currentUser && currentUser.get('staff') && this.siteSettings.enable_whispers && action === Composer.REPLY;
}, },
@computed("popupMenuOptions")
showPopupMenu(popupMenuOptions) {
return popupMenuOptions.some(option => option.condition);
},
@computed("model.composeState") @computed("model.composeState")
popupMenuOptions(composeState) { popupMenuOptions(composeState) {
if (composeState === 'open') { if (composeState === 'open') {

View file

@ -1,7 +1,7 @@
{{#if visible}} {{#if visible}}
<div class='contents'> <div class='contents'>
{{#if currentUser.staff}} {{#if showPopupMenu}}
{{#popup-menu visible=optionsVisible hide="hideOptions" title="composer.options"}} {{#popup-menu visible=optionsVisible hide="hideOptions" title="composer.options"}}
{{#each popupMenuOptions as |option|}} {{#each popupMenuOptions as |option|}}
{{#if option.condition}} {{#if option.condition}}
@ -90,7 +90,7 @@
composer=model composer=model
lastValidatedAt=lastValidatedAt lastValidatedAt=lastValidatedAt
canWhisper=canWhisper canWhisper=canWhisper
popupMenuOptions=popupMenuOptions showPopupMenu=showPopupMenu
draftStatus=model.draftStatus draftStatus=model.draftStatus
isUploading=isUploading isUploading=isUploading
groupsMentioned="groupsMentioned" groupsMentioned="groupsMentioned"