Allow first post to be hidden/restored

Anti-spam extensions may automatically hide the first post in a
discussion, and thus we had to implement smarter permissions so
discussions with zero posts wouldn't be visible to users other than the
author/mods. This change allows those hidden posts to be restored again.
This commit is contained in:
Toby Zerner
2015-09-07 16:03:41 +09:30
parent 05c44ad2df
commit 8c4e095f23
2 changed files with 12 additions and 22 deletions

View File

@ -87,20 +87,18 @@ export default {
destructiveControls(post) {
const items = new ItemList();
if (post.number() !== 1) {
if (post.contentType() === 'comment' && !post.isHidden() && post.canEdit()) {
items.add('hide', Button.component({
icon: 'times',
children: app.trans('core.delete'),
onclick: this.hideAction.bind(post)
}));
} else if ((post.contentType() !== 'comment' || post.isHidden()) && post.canDelete()) {
items.add('delete', Button.component({
icon: 'times',
children: app.trans('core.delete_forever'),
onclick: this.deleteAction.bind(post)
}));
}
if (post.contentType() === 'comment' && !post.isHidden() && post.canEdit()) {
items.add('hide', Button.component({
icon: 'times',
children: app.trans('core.delete'),
onclick: this.hideAction.bind(post)
}));
} else if (post.number() !== 1 && (post.contentType() !== 'comment' || post.isHidden()) && post.canDelete()) {
items.add('delete', Button.component({
icon: 'times',
children: app.trans('core.delete_forever'),
onclick: this.deleteAction.bind(post)
}));
}
return items;