From 60e90faf2e81201f4d9015f109646c271dc238e7 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/framework/core/src/Core/Handlers/Commands/EditPostCommandHandler.php b/framework/core/src/Core/Handlers/Commands/EditPostCommandHandler.php index 8ad795cab..7528dfefc 100644 --- a/framework/core/src/Core/Handlers/Commands/EditPostCommandHandler.php +++ b/framework/core/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 {