mirror of
https://github.com/flarum/core.git
synced 2025-08-20 15:21:49 +02:00
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:
@@ -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;
|
||||
|
Reference in New Issue
Block a user