mirror of
https://github.com/flarum/framework.git
synced 2024-12-02 23:23:52 +08:00
Allow users to hide their own posts just as they can edit them
This fixes a regression introduced by #1466.
This commit is contained in:
parent
64a7e8ac3a
commit
18b90d16e3
|
@ -115,9 +115,9 @@ class PostPolicy extends AbstractPolicy
|
||||||
*/
|
*/
|
||||||
public function edit(User $actor, Post $post)
|
public function edit(User $actor, Post $post)
|
||||||
{
|
{
|
||||||
// A post is allowed to be edited if the user has permission to moderate
|
// A post is allowed to be edited if the user is the author, the post
|
||||||
// the discussion which it's in, or if they are the author and the post
|
// hasn't been deleted by someone else, and the user is allowed to
|
||||||
// hasn't been deleted by someone else.
|
// create new replies in the discussion.
|
||||||
if ($post->user_id == $actor->id && (! $post->hidden_at || $post->hidden_user_id == $actor->id) && $actor->can('reply', $post->discussion)) {
|
if ($post->user_id == $actor->id && (! $post->hidden_at || $post->hidden_user_id == $actor->id) && $actor->can('reply', $post->discussion)) {
|
||||||
$allowEditing = $this->settings->get('allow_post_editing');
|
$allowEditing = $this->settings->get('allow_post_editing');
|
||||||
|
|
||||||
|
@ -128,4 +128,14 @@ class PostPolicy extends AbstractPolicy
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param User $actor
|
||||||
|
* @param Post $post
|
||||||
|
* @return bool|null
|
||||||
|
*/
|
||||||
|
public function hide(User $actor, Post $post)
|
||||||
|
{
|
||||||
|
return $this->edit($actor, $post);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user