mirror of
https://github.com/flarum/core.git
synced 2025-08-06 08:27:42 +02:00
Only merge posts if same user
This commit is contained in:
@@ -16,16 +16,21 @@ class DiscussionMovedPost extends ActivityPost
|
|||||||
* Merge the post into another post of the same type.
|
* Merge the post into another post of the same type.
|
||||||
*
|
*
|
||||||
* @param \Flarum\Core\Models\Model $previous
|
* @param \Flarum\Core\Models\Model $previous
|
||||||
* @return boolean true if the post was merged, false if it was deleted.
|
* @return \Flarum\Core\Models\Model|null The final model, or null if the
|
||||||
|
* previous post was deleted.
|
||||||
*/
|
*/
|
||||||
protected function mergeInto(Model $previous)
|
protected function mergeInto(Model $previous)
|
||||||
{
|
{
|
||||||
|
if ($this->user_id === $previous->user_id) {
|
||||||
if ($previous->content[0] == $this->content[1]) {
|
if ($previous->content[0] == $this->content[1]) {
|
||||||
return false;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$previous->content = static::buildContent($previous->content[0], $this->content[1]);
|
$previous->content = static::buildContent($previous->content[0], $this->content[1]);
|
||||||
return true;
|
return $previous;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user