Skip to content

Commit

Permalink
Notion: include page emoji
Browse files Browse the repository at this point in the history
  • Loading branch information
rjbs committed Aug 24, 2021
1 parent cb34e8c commit 0dc081b
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/Synergy/Reactor/Notion.pm
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ sub handle_my_projects ($self, $event) {

'User-Agent' => 'Synergy/2021.05',
Authorization => "Bearer $token",
'Notion-Version' => '2021-05-13',
'Notion-Version' => '2021-08-16',
'Content-Type' => 'application/json',
Content => "{}", # TODO: filter here for real
)->get; # TODO: use sequencing
Expand All @@ -81,15 +81,17 @@ sub handle_my_projects ($self, $event) {
next unless grep {; $_->{person}{email} eq $email } @people;
my $title = join q{ - }, map {; $_->{plain_text} } $page->{properties}{Name}{title}->@*;

my $emoji = $page->{properties}{icon}{emoji} // "\N{FILE FOLDER}";

my $safe_title = $title;
$safe_title =~ s{[^A-Za-z0-9]}{-}g;

my $id = $page->{id} =~ s/-//gr;

my $href = "https://www.notion.so/$safe_title-$id";

$reply .= "$title ($stage)\n";
$slack .= sprintf "<%s|%s> (%s)\n", $href, $title, $stage;
$reply .= "$emoji $title ($stage)\n";
$slack .= sprintf "<%s|%s %s> (%s)\n", $href, $emoji, $title, $stage;
}

unless (length $reply) {
Expand Down

0 comments on commit 0dc081b

Please sign in to comment.