Prevent unnecessary events from being triggered

This commit is contained in:
Toby Zerner 2015-02-10 17:49:42 +10:30
parent 8e6011e8d0
commit f56da376da

View File

@ -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;