Users should not be able to restore discussions if deleted by admins (#2037)

This commit is contained in:
Alexander Skvortsov 2020-03-20 10:57:03 -04:00 committed by GitHub
parent a2d1d2b819
commit e10da825d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -139,7 +139,11 @@ class DiscussionPolicy extends AbstractPolicy
*/
public function hide(User $actor, Discussion $discussion)
{
if ($discussion->user_id == $actor->id && $discussion->participant_count <= 1 && $actor->can('reply', $discussion)) {
if ($discussion->user_id == $actor->id
&& $discussion->participant_count <= 1
&& (! $discussion->hidden_at || $discussion->hidden_user_id == $actor->id)
&& $actor->can('reply', $discussion)
) {
return true;
}
}