Skip to content

Commit

Permalink
Reactor/Linear: Implement 'triage /all'
Browse files Browse the repository at this point in the history
The 'triage' command by default shows only unassigned issues, in order
to assist with triaging tickets created or moved from other teams.

However, tickets we (in PLAT) create for triage through `synergy ++`
will have the creator assigned. This is fine but we want to be able to
query synergy for these tickets, so we do that with `synergy triage plat
/all`.

Ticket: PLAT-2422
  • Loading branch information
lerlacher-fm committed Dec 2, 2024
1 parent 32efab4 commit 0070055
Showing 1 changed file with 25 additions and 5 deletions.
30 changes: 25 additions & 5 deletions lib/Synergy/Reactor/Linear.pm
Original file line number Diff line number Diff line change
Expand Up @@ -712,14 +712,31 @@ command triage => {
*triage `[TEAM]`*: list unassigned issues in the Triage state
This lists (the first page of) all unassigned issues in the Triage state in
Linear. You can supply an argument, the name of a team, to see only issues
for that team.
Linear.
You can supply an argument, the name of a team, to see only issues for that
team.
You can supply a switch, /all, to also see assigned issues.
EOH
} => async sub ($self, $event, $team_name) {
} => async sub ($self, $event, $text) {
await $self->_with_linear_client($event, async sub ($linear) {
my %extra_search;

if (length $team_name) {
# I've implemented half of a getopt parser here... sorry
my $opt_all = 0;
my @args;

my @words = split ' ', $text if length $text;

for my $arg (@words) {
if ($arg eq '/all') {
$opt_all = 1;
} else {
push @args, $arg;
}
}

if (length $args[0]) {
my $team_name = $args[0];
my $team = await $linear->lookup_team($team_name);

unless ($team) {
Expand All @@ -729,12 +746,15 @@ command triage => {
%extra_search = (team => $team->{id});
}

if (!$opt_all) {
$extra_search{assignee} = undef;
}

return await $self->_handle_search(
$event,
{
search => {
state => 'Triage',
assignee => undef,
%extra_search,
},
zero => "No unassigned issues in triage! Great!",
Expand Down

0 comments on commit 0070055

Please sign in to comment.