From 85097660f099526c89c337ef5d2c0f43c491bf75 Mon Sep 17 00:00:00 2001 From: Toby Zerner Date: Tue, 10 Feb 2015 17:49:42 +1030 Subject: [PATCH] Prevent unnecessary events from being triggered --- framework/core/src/Flarum/Core/Posts/CommentPost.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/framework/core/src/Flarum/Core/Posts/CommentPost.php b/framework/core/src/Flarum/Core/Posts/CommentPost.php index 8836eba71..b209d5ad9 100755 --- a/framework/core/src/Flarum/Core/Posts/CommentPost.php +++ b/framework/core/src/Flarum/Core/Posts/CommentPost.php @@ -39,6 +39,10 @@ class CommentPost extends Post public function revise($content, $user) { + if ($this->content === $content) { + return; + } + $this->content = $content; $this->content_html = static::formatContent($this->content); @@ -50,6 +54,10 @@ class CommentPost extends Post public function hide($user) { + if ($this->delete_time) { + return; + } + $this->delete_time = time(); $this->delete_user_id = $user->id; @@ -58,6 +66,10 @@ class CommentPost extends Post public function restore($user) { + if ($this->delete_time === null) { + return; + } + $this->delete_time = null; $this->delete_user_id = null;