Skip to content

Commit

Permalink
squashme: fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
lerlacher-fm committed Jan 2, 2025
1 parent db03496 commit 7307ef8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
15 changes: 6 additions & 9 deletions lib/Synergy/Reactor/Page.pm
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ Special On-Call paging:
• *page /all oncall: `MESSAGE`*: send this message to all oncall engineers
END
} => async sub ($self, $event, $rest) {
#my ($who, $what) = $event->text =~ m/^page\s+@?([a-z]+):?\s+(.*)/is;
# I've implemented half of a getopt parser here... sorry
my $opt_all = 0;
my @args;
Expand All @@ -80,8 +79,9 @@ END
return await $event->error_reply("usage: page USER: MESSAGE");
}

my $who = $args[0] =~ s/:$//r;
my $what = join ' ', @args[1 .. $#args];
my $who = shift @args;
$who = ($who =~ s/:$//r);
my $what = join ' ', @args;

my @to_page;
if ($who eq 'oncall') {
Expand All @@ -92,12 +92,9 @@ END
# eagerly enough. That should probably be made into a lazily cached
# attribute like we use for (for example) the Slack user list. But we
# can do that in the future. -- rjbs, 2023-10-18
my @oncall_ids;
if ($opt_all) {
@oncall_ids = await $pd->_escalation_oncalls;
} else {
@oncall_ids = await $pd->_current_oncall_ids;
}
my @oncall_ids = $opt_all
? await $pd->_escalation_oncall_ids
: await $pd->_current_oncall_ids;
@to_page = grep {; $_ } map {; $pd->username_from_pd($_) } @oncall_ids;
} else {
$Logger->log("Unable to find reactor 'pagerduty'") unless $pd;
Expand Down
2 changes: 1 addition & 1 deletion lib/Synergy/Reactor/PagerDuty.pm
Original file line number Diff line number Diff line change
Expand Up @@ -739,7 +739,7 @@ sub _current_oncall_ids ($self) {

# returns all the oncall users on the final escalation rule
# used for "page all oncall engineers"
sub _escalation_oncalls ($self) {
sub _escalation_oncall_ids ($self) {
my $policy_id = $self->escalation_policy_id;

return $self->_pd_request(GET => '/escalation_policies/' . $policy_id)
Expand Down

0 comments on commit 7307ef8

Please sign in to comment.