Skip to content

Commit e4856a8

Browse files
committed
Patch: Delete last complete or reopen comment only if both changes are made by the same user and within 1 minute
1 parent a175540 commit e4856a8

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/Controllers/TicketsController.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2278,8 +2278,9 @@ public function complete_change_actions($ticket, $member, $member_reason = false
22782278
{
22792279
$latest = Models\Comment::where('ticket_id', $ticket->id)->orderBy('id', 'desc')->first();
22802280

2281-
if ($latest and in_array($latest->type, ['complete', 'reopen'])) {
2282-
// Delete last comment for consecutive complete-reopen
2281+
if ($latest and $latest->owner->id == $this->member->id and in_array($latest->type, ['complete', 'reopen'])
2282+
and Carbon::now()->diffInSeconds($latest->created_at) < 60) {
2283+
// Delete last complete or reopen comment if both changes come from the same user and within 1 minute
22832284
$latest->delete();
22842285

22852286
return false;

0 commit comments

Comments
 (0)