mirror of
https://github.com/flarum/framework.git
synced 2025-03-04 00:21:13 +08:00
Be more specific as to when we require edit permission
Since we update per-user data (e.g. isLiked) through this command’s event
This commit is contained in:
parent
06a50e92aa
commit
60e90faf2e
@ -21,14 +21,16 @@ class EditPostCommandHandler
|
|||||||
$user = $command->user;
|
$user = $command->user;
|
||||||
$post = $this->posts->findOrFail($command->postId, $user);
|
$post = $this->posts->findOrFail($command->postId, $user);
|
||||||
|
|
||||||
$post->assertCan($user, 'edit');
|
|
||||||
|
|
||||||
if ($post instanceof CommentPost) {
|
if ($post instanceof CommentPost) {
|
||||||
if (isset($command->data['content'])) {
|
if (isset($command->data['content'])) {
|
||||||
|
$post->assertCan($user, 'edit');
|
||||||
|
|
||||||
$post->revise($command->data['content'], $user);
|
$post->revise($command->data['content'], $user);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($command->data['isHidden'])) {
|
if (isset($command->data['isHidden'])) {
|
||||||
|
$post->assertCan($user, 'edit');
|
||||||
|
|
||||||
if ($command->data['isHidden']) {
|
if ($command->data['isHidden']) {
|
||||||
$post->hide($user);
|
$post->hide($user);
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user