From 7c0accf14f1d64b45814785d5c53ba01eabae9f4 Mon Sep 17 00:00:00 2001 From: Toby Zerner Date: Thu, 25 Jun 2015 08:38:18 +0930 Subject: [PATCH] Be more specific as to when we require edit permission MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since we update per-user data (e.g. isLiked) through this command’s event --- src/Core/Handlers/Commands/EditPostCommandHandler.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Core/Handlers/Commands/EditPostCommandHandler.php b/src/Core/Handlers/Commands/EditPostCommandHandler.php index 8ad795cab..7528dfefc 100644 --- a/src/Core/Handlers/Commands/EditPostCommandHandler.php +++ b/src/Core/Handlers/Commands/EditPostCommandHandler.php @@ -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 {