diff --git a/app/assets/javascripts/discourse/widgets/post-admin-menu.js.es6 b/app/assets/javascripts/discourse/widgets/post-admin-menu.js.es6 index 37e4c642a74..17332ba6569 100644 --- a/app/assets/javascripts/discourse/widgets/post-admin-menu.js.es6 +++ b/app/assets/javascripts/discourse/widgets/post-admin-menu.js.es6 @@ -23,7 +23,6 @@ export default createWidget('post-admin-menu', { const contents = []; contents.push(h('h3', I18n.t('admin_title'))); - if (!attrs.isWhisper && this.currentUser.staff) { const buttonAtts = { action: 'togglePostType', icon: 'shield', className: 'toggle-post-type' }; @@ -35,25 +34,32 @@ export default createWidget('post-admin-menu', { contents.push(this.attach('post-admin-menu-button', buttonAtts)); } - contents.push(this.attach('post-admin-menu-button', { - icon: 'cog', label: 'post.controls.rebake', action: 'rebakePost', className: 'rebuild-html' - })); - - if (attrs.hidden) { + if (attrs.canManage) { contents.push(this.attach('post-admin-menu-button', { - icon: 'eye', - label: 'post.controls.unhide', - action: 'unhidePost', - className: 'unhide-post' + icon: 'cog', label: 'post.controls.rebake', action: 'rebakePost', className: 'rebuild-html' })); + + if (attrs.hidden) { + contents.push(this.attach('post-admin-menu-button', { + icon: 'eye', label: 'post.controls.unhide', action: 'unhidePost', className: 'unhide-post' + })); + } } if (this.currentUser.admin) { contents.push(this.attach('post-admin-menu-button', { - icon: 'user', - label: 'post.controls.change_owner', - action: 'changePostOwner', - className: 'change-owner' + icon: 'user', label: 'post.controls.change_owner', action: 'changePostOwner', className: 'change-owner' + })); + } + + // toggle Wiki button + if (attrs.wiki) { + contents.push(this.attach('post-admin-menu-button', { + action: 'toggleWiki', label: 'post.controls.unwiki', icon: 'pencil-square-o', className: 'wiki wikied' + })); + } else { + contents.push(this.attach('post-admin-menu-button', { + action: 'toggleWiki', label: 'post.controls.wiki', icon: 'pencil-square-o', className: 'wiki' })); } @@ -64,4 +70,3 @@ export default createWidget('post-admin-menu', { this.sendWidgetAction('closeAdminMenu'); } }); - diff --git a/app/assets/javascripts/discourse/widgets/post-menu.js.es6 b/app/assets/javascripts/discourse/widgets/post-menu.js.es6 index aff7d61fa28..4fb2cdef5c4 100644 --- a/app/assets/javascripts/discourse/widgets/post-menu.js.es6 +++ b/app/assets/javascripts/discourse/widgets/post-menu.js.es6 @@ -81,8 +81,7 @@ registerButton('edit', attrs => { className: 'edit', title: 'post.controls.edit', icon: 'pencil', - alwaysShowYours: true, - alwaysShowWiki: true + alwaysShowYours: true }; } }); @@ -161,7 +160,7 @@ registerButton('bookmark', attrs => { }); registerButton('admin', attrs => { - if (!attrs.canManage) { return; } + if (!attrs.canManage && !attrs.canWiki) { return; } return { action: 'openAdminMenu', title: 'post.controls.admin', className: 'show-post-admin-menu', @@ -180,22 +179,6 @@ registerButton('delete', attrs => { } }); -registerButton('wiki', attrs => { - if (!attrs.canWiki) { return; } - - if (attrs.wiki) { - return { action: 'toggleWiki', - title: 'post.controls.unwiki', - icon: 'pencil-square-o', - className: 'wiki wikied' }; - } else { - return { action: 'toggleWiki', - title: 'post.controls.wiki', - icon: 'pencil-square-o', - className: 'wiki' }; - } -}); - export default createWidget('post-menu', { tagName: 'section.post-menu-area.clearfix', @@ -229,9 +212,7 @@ export default createWidget('post-menu', { const button = this.attachButton(i, attrs); if (button) { allButtons.push(button); - if ((attrs.yours && button.attrs.alwaysShowYours) || - (attrs.wiki && button.attrs.alwaysShowWiki) || - (hiddenButtons.indexOf(i) === -1)) { + if ((attrs.yours && button.attrs.alwaysShowYours) || (hiddenButtons.indexOf(i) === -1)) { visibleButtons.push(button); } } diff --git a/config/site_settings.yml b/config/site_settings.yml index 4d516bc1e4a..bb593681b84 100644 --- a/config/site_settings.yml +++ b/config/site_settings.yml @@ -108,7 +108,7 @@ basic: post_menu: client: true type: list - default: 'like-count|like|share|flag|edit|bookmark|wiki|delete|admin|reply' + default: 'like-count|like|share|flag|edit|bookmark|delete|admin|reply' choices: - like-count - like @@ -119,11 +119,10 @@ basic: - bookmark - admin - reply - - wiki post_menu_hidden_items: client: true type: list - default: 'bookmark|edit|wiki|delete|admin' + default: 'bookmark|edit|delete|admin' choices: - like - edit @@ -133,7 +132,6 @@ basic: - bookmark - admin - reply - - wiki share_links: client: true type: list