Add comment restore button

This commit is contained in:
2026-05-06 21:15:15 +02:00
parent 75f631c3e6
commit 09c08f3fea
3 changed files with 44 additions and 0 deletions

View File

@@ -25,4 +25,19 @@ class CommentPolicy
return $user->id === $comment->user_id;
}
public function restore(User $user, Comment $comment): bool
{
// Comment not deleted
if ($comment->deleted_by_moderator_id === null) {
return false;
}
if ($user->hasRole(UserRole::ADMINISTRATOR) ||
$user->hasRole(UserRole::MODERATOR)) {
return true;
}
return false;
}
}