Skip to content

Commit

Permalink
Fixed an issue with merging posts when there is an event post between…
Browse files Browse the repository at this point in the history
… them (#26)

* Fixed #25

* StyleCI fix

* StyleCI fix2

* StyleCI fix3
  • Loading branch information
rafaucau committed Jun 26, 2021
1 parent f9f3648 commit 4d65b82
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/Listener/AutoMerge.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,14 @@ public function handle(Posted $event)
->orderBy('number', 'desc')
->firstOrFail();

if (!$oldPost instanceof CommentPost) {
return;
}

$cooldown = $this->settings->get('fof-filter.cooldown') ?? '15';

if ($oldPost->user_id == $post->user_id && strtotime("-$cooldown minutes") < strtotime($oldPost->created_at)) {
$oldPost->revise($oldPost->content.'
'.$post->content, $post->user);
$oldPost->revise($oldPost->content."\n\n".$post->content, $post->user);

$oldPost->save();

Expand Down

0 comments on commit 4d65b82

Please sign in to comment.