From 60bafae8a0688b442edce54db549ba22a5df0aba Mon Sep 17 00:00:00 2001 From: Jared Vititoe Date: Tue, 8 Sep 2026 21:49:34 -0400 Subject: [PATCH] Redact ticket title for non-public tickets in assignment notifications (#72) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sendAssignmentNotification() had the same missing-visibility gap as #46 in a separate function: assigning a user to a confidential/internal ticket broadcast the ticket title to the shared Matrix notify list unconditionally when MATRIX_NOTIFY_ASSIGNMENTS is enabled. Threaded visibility through using the same redactedTitle() helper added for #46, wired up from the already-fetched ticket row in assign_ticket.php. The assignee is still DMed directly regardless, since being assigned gives them standing access to the ticket — but because notify_users is one shared payload, they see the same redacted title as everyone else on it rather than a personalized one. Verified end-to-end with a local HTTP server capturing the webhook payload for both public and confidential tickets. Co-Authored-By: Claude Sonnet 5 Claude-Session: https://claude.ai/code/session_015nCxwFFsy8ouMWzn56rPVP --- api/assign_ticket.php | 3 ++- helpers/NotificationHelper.php | 10 ++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/api/assign_ticket.php b/api/assign_ticket.php index c616de5..1046909 100644 --- a/api/assign_ticket.php +++ b/api/assign_ticket.php @@ -76,7 +76,8 @@ if ($assignedTo === null || $assignedTo === '') { $ticket['title'] ?? "Ticket #{$ticketId}", $assigneeName, $assigneeMatrix, - $changedByDisplay + $changedByDisplay, + $ticket['visibility'] ?? 'public' ); } } diff --git a/helpers/NotificationHelper.php b/helpers/NotificationHelper.php index 532d8aa..179043f 100644 --- a/helpers/NotificationHelper.php +++ b/helpers/NotificationHelper.php @@ -280,8 +280,14 @@ class NotificationHelper * @param string|null $assigneeName Display name of new assignee * @param string|null $assigneeMatrix Matrix user ID of new assignee (to DM) * @param string|null $changedByDisplay + * @param string $visibility Ticket visibility; non-public titles are + * redacted before being sent to the shared + * notify list, same as sendTicketNotification(). + * The assignee is DMed directly regardless, + * since they now have standing access to the + * ticket by virtue of being assigned to it. */ - public static function sendAssignmentNotification($ticketId, string $ticketTitle, ?string $assigneeName, ?string $assigneeMatrix, ?string $changedByDisplay = null): void + public static function sendAssignmentNotification($ticketId, string $ticketTitle, ?string $assigneeName, ?string $assigneeMatrix, ?string $changedByDisplay = null, string $visibility = 'public'): void { $notifyUsers = self::notifyUsers(); // Also notify the assignee directly if we know their Matrix ID @@ -295,7 +301,7 @@ class NotificationHelper self::fire([ 'event' => 'assigned', 'ticket_id' => $ticketId, - 'title' => $ticketTitle, + 'title' => self::redactedTitle($ticketTitle, $visibility), 'assignee' => $assigneeName, 'changed_by' => $changedByDisplay, 'url' => UrlHelper::ticketUrl($ticketId),