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:
Toby Zerner 2015-06-25 08:38:18 +09:30
parent f3b8c31e18
commit 7c0accf14f

View File

@ -21,14 +21,16 @@ class EditPostCommandHandler
$user = $command->user;
$post = $this->posts->findOrFail($command->postId, $user);
$post->assertCan($user, 'edit');
if ($post instanceof CommentPost) {
if (isset($command->data['content'])) {
$post->assertCan($user, 'edit');
$post->revise($command->data['content'], $user);
}
if (isset($command->data['isHidden'])) {
$post->assertCan($user, 'edit');
if ($command->data['isHidden']) {
$post->hide($user);
} else {