mirror of
https://github.com/flarum/framework.git
synced 2024-11-23 01:51:05 +08:00
Prevent unnecessary events from being triggered
This commit is contained in:
parent
8e6011e8d0
commit
f56da376da
|
@ -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