Skip to content

Commit 034ef63

Browse files
committed
fix(SCW-82): resolve team key in issues list
The `issues list` command filtered by team name only, so `-t SCW` (team key) returned no results while `-t "Southernwind Enterprise"` (full name) worked. Now resolves team key/name to UUID upfront via `resolve_team_id`, matching the pattern used by all other commands.
1 parent 5103bec commit 034ef63

1 file changed

Lines changed: 15 additions & 8 deletions

File tree

‎src/commands/issues.rs‎

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -491,6 +491,13 @@ async fn list_issues(
491491
) -> Result<()> {
492492
let client = LinearClient::new()?;
493493

494+
// Resolve team key/name to ID upfront (supports both key like "SCW" and full name)
495+
let team_id = if let Some(ref t) = team {
496+
Some(resolve_team_id(&client, t, &output.cache).await?)
497+
} else {
498+
None
499+
};
500+
494501
// Parse --since date
495502
let since_date = if let Some(ref since_str) = since {
496503
let date = crate::dates::parse_due_date(since_str)
@@ -540,15 +547,15 @@ async fn list_issues(
540547
"#
541548
} else {
542549
r#"
543-
query($team: String, $state: String, $assignee: String, $project: String, $includeArchived: Boolean, $first: Int, $after: String, $last: Int, $before: String) {
550+
query($teamId: ID, $state: String, $assignee: String, $project: String, $includeArchived: Boolean, $first: Int, $after: String, $last: Int, $before: String) {
544551
issues(
545552
first: $first,
546553
after: $after,
547554
last: $last,
548555
before: $before,
549556
includeArchived: $includeArchived,
550557
filter: {
551-
team: { name: { eqIgnoreCase: $team } },
558+
team: { id: { eq: $teamId } },
552559
state: { name: { eqIgnoreCase: $state } },
553560
assignee: { name: { eqIgnoreCase: $assignee } },
554561
project: { name: { eqIgnoreCase: $project } }
@@ -585,9 +592,9 @@ async fn list_issues(
585592
}
586593
}
587594
// Merge CLI filters on top of view filter
588-
if let Some(t) = team {
595+
if let Some(ref t) = team_id {
589596
if let Some(obj) = filter.as_object_mut() {
590-
obj.insert("team".to_string(), json!({ "name": { "eqIgnoreCase": t } }));
597+
obj.insert("team".to_string(), json!({ "id": { "eq": t } }));
591598
}
592599
}
593600
if let Some(s) = state {
@@ -617,8 +624,8 @@ async fn list_issues(
617624
if let Some(ref since_ts) = since_date {
618625
filter["createdAt"] = json!({ "gte": since_ts });
619626
}
620-
if let Some(t) = team {
621-
filter["team"] = json!({ "name": { "eqIgnoreCase": t } });
627+
if let Some(ref t) = team_id {
628+
filter["team"] = json!({ "id": { "eq": t } });
622629
}
623630
if let Some(s) = state {
624631
filter["state"] = json!({ "name": { "eqIgnoreCase": s } });
@@ -634,8 +641,8 @@ async fn list_issues(
634641
}
635642
variables.insert("filter".to_string(), filter);
636643
} else {
637-
if let Some(t) = team {
638-
variables.insert("team".to_string(), json!(t));
644+
if let Some(ref t) = team_id {
645+
variables.insert("teamId".to_string(), json!(t));
639646
}
640647
if let Some(s) = state {
641648
variables.insert("state".to_string(), json!(s));

0 commit comments

Comments
 (0)