Skip to content

Commit 60c3137

Browse files
authored
chore: admin can delete any comment (#413)
1 parent 8b08acc commit 60c3137

File tree

1 file changed

+10
-9
lines changed
  • apps/client/components/TicketDetails

1 file changed

+10
-9
lines changed

apps/client/components/TicketDetails/index.tsx

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1009,15 +1009,16 @@ export default function Ticket() {
10091009
<span className="text-xs lowercase">
10101010
{moment(comment.createdAt).format("LLL")}
10111011
</span>
1012-
{comment.user &&
1013-
comment.userId === user.id && (
1014-
<Trash2
1015-
className="h-4 w-4 absolute top-2 right-2 opacity-0 group-hover:opacity-100 transition-opacity cursor-pointer text-muted-foreground hover:text-destructive"
1016-
onClick={() => {
1017-
deleteComment(comment.id);
1018-
}}
1019-
/>
1020-
)}
1012+
{(user.isAdmin ||
1013+
(comment.user &&
1014+
comment.userId === user.id)) && (
1015+
<Trash2
1016+
className="h-4 w-4 absolute top-2 right-2 opacity-0 group-hover:opacity-100 transition-opacity cursor-pointer text-muted-foreground hover:text-destructive"
1017+
onClick={() => {
1018+
deleteComment(comment.id);
1019+
}}
1020+
/>
1021+
)}
10211022
</div>
10221023
<span className="ml-1">{comment.text}</span>
10231024
</li>

0 commit comments

Comments
 (0)