1
0
mirror of https://github.com/flarum/core.git synced 2025-07-30 21:20:24 +02: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:
Toby Zerner
2016-05-28 09:43:21 +09:30
parent a380424de4
commit 2d5a7ce064
4 changed files with 35 additions and 29 deletions

View File

@@ -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;