diff --git a/js/forum/src/utils/PostControls.js b/js/forum/src/utils/PostControls.js index b258c5f63..7429e249b 100644 --- a/js/forum/src/utils/PostControls.js +++ b/js/forum/src/utils/PostControls.js @@ -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; diff --git a/src/Core/Posts/CommentPost.php b/src/Core/Posts/CommentPost.php index 580be793a..db113392c 100755 --- a/src/Core/Posts/CommentPost.php +++ b/src/Core/Posts/CommentPost.php @@ -89,10 +89,6 @@ class CommentPost extends Post */ public function hide(User $actor = null) { - if ($this->number == 1) { - throw new DomainException('Cannot hide the first post of a discussion'); - } - if (! $this->hide_time) { $this->hide_time = time(); $this->hide_user_id = $actor ? $actor->id : null; @@ -110,10 +106,6 @@ class CommentPost extends Post */ public function restore() { - if ($this->number == 1) { - throw new DomainException('Cannot restore the first post of a discussion'); - } - if ($this->hide_time !== null) { $this->hide_time = null; $this->hide_user_id = null;