From 542b6ec44884108f83280e65f5c58b0afb4e0891 Mon Sep 17 00:00:00 2001 From: Ricardo Signes Date: Thu, 27 Jun 2024 13:56:44 -0400 Subject: [PATCH] LinearNotification: use TEAM-123 as link text --- lib/Synergy/Reactor/LinearNotification.pm | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/lib/Synergy/Reactor/LinearNotification.pm b/lib/Synergy/Reactor/LinearNotification.pm index 8c6a9642..66eadf4f 100644 --- a/lib/Synergy/Reactor/LinearNotification.pm +++ b/lib/Synergy/Reactor/LinearNotification.pm @@ -150,25 +150,29 @@ sub http_app ($self, $env) { my $app = $was_create ? 'Zendesk' : 'Linear'; $who = 'someone' unless $was_create; - my $text = sprintf - "%s %s escalation by %s in %s: %s (%s)", + my $base_text = sprintf + "%s %s escalation by %s in %s: %s", $ESCALATION_EMOJI, $desc, $who, $app, - $payload->{data}{title}, - $payload->{url}; + $payload->{data}{title}; + + my ($identifier) = $payload->{url} =~ m{/linear\.app/issue/([A-Z]+-[0-9]+)/}; + $identifier //= $payload->{url}; + my $text = "$base_text ($payload->{url})"; + my $slack = "$base_text (<$payload->{url}|$identifier>)"; if (my $rototron = $self->_rototron) { my $roto_reactor = $self->hub->reactor_named('rototron'); for my $officer ($roto_reactor->current_triage_officers) { $Logger->log(["notifying %s of new escalation task", $officer->username ]); - $channel->send_message_to_user($officer, $text); + $channel->send_message_to_user($officer, $text, { slack => $slack }); } } - return $channel->send_message($self->escalation_address, $text); + return $channel->send_message($self->escalation_address, $text, { slack => $slack }); })->catch(sub { $Logger->log("failed to tell escalation about a ticket create in linear: @_");