Skip to content

Commit e832835

Browse files
committed
Notify other comment authors
1 parent 312a086 commit e832835

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

src/Controllers/NotificationsController.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,13 +160,18 @@ public function newComment(Comment $comment, $request)
160160

161161
// Add all members notified previously
162162
$a_recipients = array_unique(array_merge($a_recipients, $ticket->commentNotifications()->where('member_id', '!=', $member->id)->groupBy('member_id')->pluck('member_id')->toArray()));
163-
163+
164+
// Add all comment / note authors
165+
foreach ($ticket->comments()->with('owner')->get() as $comm){
166+
if ($member->id != $comm->owner->id and !in_array($comm->owner->id, $a_recipients)) $a_recipients[] = $comm->owner->id;
167+
}
168+
164169
if (!is_null($ticket->owner) and $member->id != $ticket->owner->id and !in_array($ticket->owner->id, $a_recipients)){
165170
// Add ticket owner if it's not the same as who comments
166171
$a_recipients[] = $ticket->owner->id;
167172
}
168173

169-
}elseif($comment->type == 'note' or !$ticket->hidden){
174+
}else{
170175
// Selected recipients
171176
// $comment->a_recipients come from embedded comments i TicketsController
172177
// $request recipients come from a comment modal in Ticket card

0 commit comments

Comments
 (0)