mirror of
https://github.com/flarum/framework.git
synced 2024-11-28 20:16:08 +08:00
Prevent unnecessary events from being triggered
This commit is contained in:
parent
8323d2a72b
commit
85097660f0
|
@ -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;
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user