Skip to content

Commit 312a086

Browse files
committed
View comment recipients only when current member can edit ticket
1 parent 659e2c7 commit 312a086

1 file changed

Lines changed: 5 additions & 15 deletions

File tree

src/Views/tickets/partials/comments/list.blade.php

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,15 @@
33
<?php
44
$comment_title = trans('panichd::lang.comment-'.$comment->type.'-title');
55
6-
if (in_array($comment->type, ['reply', 'note'])){
7-
if (count($comment->notifications) > 0){
8-
$a_recipients = [];
9-
foreach ($comment->notifications as $recipient){
10-
$a_recipients[] = $recipient->name;
11-
}
12-
$recipients = implode(', ', $a_recipients);
13-
}
14-
}
15-
166
switch ($comment->type){
177
case 'note':
188
$icon_class = "fa fa-pencil-alt text-info";
19-
if (count($comment->notifications) == 0){
9+
if (!$u->canManageTicket($ticket->id) || count($comment->notifications) == 0){
2010
$comment_header = trans('panichd::lang.comment-note-from-agent', ['agent' => $comment->owner->name]);
2111
}else{
2212
$comment_header = trans('panichd::lang.comment-note-from-agent-to', [
2313
'agent' => $comment->owner->name,
24-
'recipients' => $recipients
14+
'recipients' => implode(', ', $comment->notifications->pluck('name')->toArray())
2515
]);
2616
}
2717
break;
@@ -50,12 +40,12 @@
5040
}else{
5141
$icon_class .= "text-warning";
5242
}
53-
if (count($comment->notifications) == 0){
43+
if (!$u->canManageTicket($ticket->id) || count($comment->notifications) == 0){
5444
$comment_header = trans('panichd::lang.comment-reply-from-owner', ['owner' => $comment->owner->name]);
5545
}else{
56-
$comment_header = trans('panichd::lang.reply-from-owner-to', [
46+
$comment_header = trans('panichd::lang.reply-from-owner-to', [
5747
'owner' => $comment->owner->name,
58-
'recipients' => $recipients
48+
'recipients' => implode(', ', $comment->notifications->pluck('name')->toArray())
5949
]);
6050
}
6151
break;

0 commit comments

Comments
 (0)