diff --git a/framework/core/js/admin/dist/app.js b/framework/core/js/admin/dist/app.js index 146989a74..554554964 100644 --- a/framework/core/js/admin/dist/app.js +++ b/framework/core/js/admin/dist/app.js @@ -21583,8 +21583,8 @@ System.register('flarum/models/Discussion', ['flarum/Model', 'flarum/utils/compu hideTime: Model.attribute('hideTime', Model.transformDate), hideUser: Model.hasOne('hideUser'), - isHidden: computed('hideTime', 'commentsCount', function (hideTime, commentsCount) { - return !!hideTime || commentsCount === 0; + isHidden: computed('hideTime', function (hideTime) { + return !!hideTime; }), canReply: Model.attribute('canReply'), diff --git a/framework/core/js/forum/dist/app.js b/framework/core/js/forum/dist/app.js index 9b3caf819..da2e30235 100644 --- a/framework/core/js/forum/dist/app.js +++ b/framework/core/js/forum/dist/app.js @@ -29107,8 +29107,8 @@ System.register('flarum/models/Discussion', ['flarum/Model', 'flarum/utils/compu hideTime: Model.attribute('hideTime', Model.transformDate), hideUser: Model.hasOne('hideUser'), - isHidden: computed('hideTime', 'commentsCount', function (hideTime, commentsCount) { - return !!hideTime || commentsCount === 0; + isHidden: computed('hideTime', function (hideTime) { + return !!hideTime; }), canReply: Model.attribute('canReply'), @@ -30179,19 +30179,22 @@ System.register('flarum/utils/DiscussionControls', ['flarum/components/Discussio onclick: this.hideAction.bind(discussion) })); } - } else if (discussion.canDelete()) { - items.add('restore', Button.component({ - icon: 'reply', - children: app.translator.trans('core.forum.discussion_controls.restore_button'), - onclick: this.restoreAction.bind(discussion), - disabled: discussion.commentsCount() === 0 - })); + } else { + if (discussion.canHide()) { + items.add('restore', Button.component({ + icon: 'reply', + children: app.translator.trans('core.forum.discussion_controls.restore_button'), + onclick: this.restoreAction.bind(discussion) + })); + } - items.add('delete', Button.component({ - icon: 'times', - children: app.translator.trans('core.forum.discussion_controls.delete_forever_button'), - onclick: this.deleteAction.bind(discussion) - })); + if (discussion.canDelete()) { + items.add('delete', Button.component({ + icon: 'times', + children: app.translator.trans('core.forum.discussion_controls.delete_forever_button'), + onclick: this.deleteAction.bind(discussion) + })); + } } return items; diff --git a/framework/core/js/forum/src/utils/DiscussionControls.js b/framework/core/js/forum/src/utils/DiscussionControls.js index 1595ef36f..951f800e8 100644 --- a/framework/core/js/forum/src/utils/DiscussionControls.js +++ b/framework/core/js/forum/src/utils/DiscussionControls.js @@ -113,19 +113,22 @@ export default { onclick: this.hideAction.bind(discussion) })); } - } else if (discussion.canDelete()) { - items.add('restore', Button.component({ - icon: 'reply', - children: app.translator.trans('core.forum.discussion_controls.restore_button'), - onclick: this.restoreAction.bind(discussion), - disabled: discussion.commentsCount() === 0 - })); + } else { + if (discussion.canHide()) { + items.add('restore', Button.component({ + icon: 'reply', + children: app.translator.trans('core.forum.discussion_controls.restore_button'), + onclick: this.restoreAction.bind(discussion) + })); + } - items.add('delete', Button.component({ - icon: 'times', - children: app.translator.trans('core.forum.discussion_controls.delete_forever_button'), - onclick: this.deleteAction.bind(discussion) - })); + if (discussion.canDelete()) { + items.add('delete', Button.component({ + icon: 'times', + children: app.translator.trans('core.forum.discussion_controls.delete_forever_button'), + onclick: this.deleteAction.bind(discussion) + })); + } } return items; diff --git a/framework/core/js/lib/models/Discussion.js b/framework/core/js/lib/models/Discussion.js index cbfad1ac3..404ae75ab 100644 --- a/framework/core/js/lib/models/Discussion.js +++ b/framework/core/js/lib/models/Discussion.js @@ -30,7 +30,7 @@ Object.assign(Discussion.prototype, { hideTime: Model.attribute('hideTime', Model.transformDate), hideUser: Model.hasOne('hideUser'), - isHidden: computed('hideTime', 'commentsCount', (hideTime, commentsCount) => !!hideTime || commentsCount === 0), + isHidden: computed('hideTime', hideTime => !!hideTime), canReply: Model.attribute('canReply'), canRename: Model.attribute('canRename'),