From 97177cc0fea54b9498af894e130eba2aac4509a4 Mon Sep 17 00:00:00 2001 From: Rasha Moumneh Date: Tue, 10 May 2022 15:01:04 -0400 Subject: [PATCH] Linear: convert slack emojis to unicode Emoji in linear issues created with Synergy get converted to Slack shortcodes, so we're converting them to unicode using the Text::SlackEmoji library --- lib/Synergy/Reactor/Linear.pm | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/Synergy/Reactor/Linear.pm b/lib/Synergy/Reactor/Linear.pm index a9711e62..459ad150 100644 --- a/lib/Synergy/Reactor/Linear.pm +++ b/lib/Synergy/Reactor/Linear.pm @@ -19,6 +19,7 @@ use Linear::Client; use Synergy::CommandPost; use Synergy::Logger '$Logger'; use Synergy::Util qw(reformat_help); +use Text::SlackEmoji; use utf8; @@ -444,6 +445,10 @@ sub _handle_creation_event ($self, $event, $arg = {}) { # Slack now "helpfully" corrects '>>' in DM to '> >'. $text =~ s/\A> >/>>/; + # convert slack emoji shortcodes to unicode + my $emoji = Text::SlackEmoji->emoji_map; + $text =~ s!:([-+a-z0-9_]+):!$emoji->{$1} // ":$1:"!ge; + my $plan_f = $linear->plan_from_input($ersatz_text // $text); # XXX: I do not like our current error-returning scheme. -- rjbs, 2021-12-10