mirror of
https://github.com/flarum/framework.git
synced 2025-02-21 08:22:41 +08:00
Make discussion "hidden" state more explicit
Previously a discussion was classified on the front-end as "hidden" if it had zero posts. This was technically a correct statement as the discussion would not be visible to the public... but it also meant that a discussion with zero posts (like one awaiting approval) was impossible for the OP to delete/hide (i.e. indicate that they made a mistake and they don't want the discussion to be approved).
This commit is contained in:
parent
a380424de4
commit
2d5a7ce064
4
js/admin/dist/app.js
vendored
4
js/admin/dist/app.js
vendored
@ -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'),
|
||||
|
31
js/forum/dist/app.js
vendored
31
js/forum/dist/app.js
vendored
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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'),
|
||||
|
Loading…
x
Reference in New Issue
Block a user