Skip to content

Commit a2abeea

Browse files
committed
remove consecutive complete and reopen comments
1 parent 14fc52c commit a2abeea

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

src/Controllers/TicketsController.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1287,6 +1287,15 @@ public function complete(Request $request, $id)
12871287
*/
12881288
public function complete_change_actions($ticket, $member, $member_reason = false, $a_clarification = false)
12891289
{
1290+
$latest = Models\Comment::where('ticket_id', $ticket->id)->where('user_id', $member->id)->orderBy('id', 'desc')->first();
1291+
1292+
if (in_array($latest->type, ['complete', 'reopen'])){
1293+
// Delete last comment for consecutive complete-reopen
1294+
$latest->delete();
1295+
return false;
1296+
}
1297+
1298+
// Create the comment
12901299
$comment = new Models\Comment;
12911300

12921301
if ($ticket->completed_at != ''){

0 commit comments

Comments
 (0)