From 043ef6fc964aa704ea143adc58322edef3a8febe Mon Sep 17 00:00:00 2001
From: Awiteb
Date: Tue, 24 Jun 2025 11:27:57 +0000
Subject: [PATCH] chore: Add the repository to authorized issue status users
Signed-off-by: Awiteb
---
src/cli/common_commands.rs | 4 +++-
src/nostr_utils/traits.rs | 5 +++++
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/src/cli/common_commands.rs b/src/cli/common_commands.rs
index b64ae92..dac77a6 100644
--- a/src/cli/common_commands.rs
+++ b/src/cli/common_commands.rs
@@ -54,6 +54,7 @@ pub async fn issue_status_command(
.add_relays(&[naddrs.extract_relays(), issue_id.relays].concat())
.await;
+ let owners = naddrs.extract_owners();
let coordinates = naddrs.clone().into_coordinates();
let repos = client.fetch_repos(&coordinates).await?;
let maintainers = repos.extract_maintainers();
@@ -68,7 +69,7 @@ pub async fn issue_status_command(
let issue_status = client
.fetch_issue_status(
issue_id.event_id,
- [maintainers.as_slice(), &[issue_event.pubkey]].concat(),
+ [maintainers.as_slice(), &[issue_event.pubkey], &owners].concat(),
)
.await?;
@@ -83,6 +84,7 @@ pub async fn issue_status_command(
))
.tag(Tag::public_key(issue_event.pubkey))
.tags(maintainers.iter().map(|p| Tag::public_key(*p)))
+ .tags(owners.iter().map(|p| Tag::public_key(*p)))
.tags(
coordinates
.into_iter()
diff --git a/src/nostr_utils/traits.rs b/src/nostr_utils/traits.rs
index e80bb03..029792d 100644
--- a/src/nostr_utils/traits.rs
+++ b/src/nostr_utils/traits.rs
@@ -192,6 +192,11 @@ impl Vec {
self.into_iter().map(|n| n.coordinate).collect()
}
+ /// Returns all repository owners' public keys from these coordinates.
+ pub fn extract_owners(&self) -> Vec {
+ self.iter().map(|n| n.public_key).collect()
+ }
+
/// Extracts all relay URLs from these coordinates
pub fn extract_relays(&self) -> Vec {
self.iter().flat_map(|n| n.relays.clone()).collect()