refactor: Support more than one naddr instead of one
This commit supports multiple naddrs for sending issues to and searching for repositories by extracting the embedded relays, and appending to the address file instead of overwriting its previous contents. A header has also been added to the `nostr-address` file to clarify its purpose. This enhancement accommodates maintainers who distribute issue tracking across multiple repositories, preventing confusion if the primary maintainer steps down. Now, issues and patches will reference all relevant repositories, not just one. Note that repositories won't automatically include all maintainers' addresses unless explicitly specified. Maintainers may manage a repository under a project-specific public key rather than individual keys. Addresses are only added to issues and patches when explicitly provided via the command or written to the address file. This prevents unintended inclusions and ensures clarity. Suggested-by: DanConwayDev <DanConwayDev@protonmail.com> Signed-off-by: Awiteb <a@4rs.nl>
This commit is contained in:
@@ -195,20 +195,27 @@ impl NostrClient {
|
||||
.first_owned())
|
||||
}
|
||||
|
||||
/// Try to fetch a repository and returns it
|
||||
pub async fn fetch_repo(
|
||||
/// Try to fetch the reposotoies and returns them
|
||||
pub async fn fetch_repos(
|
||||
&self,
|
||||
repo_naddr: &Coordinate,
|
||||
) -> N34Result<GitRepositoryAnnouncement> {
|
||||
let filter = Filter::new()
|
||||
.author(repo_naddr.public_key)
|
||||
.kind(Kind::GitRepoAnnouncement)
|
||||
.identifier(&repo_naddr.identifier);
|
||||
|
||||
self.fetch_event(filter)
|
||||
.await?
|
||||
.map(|e| utils::event_into_repo(e, &repo_naddr.identifier))
|
||||
.ok_or(N34Error::NotFoundRepo)
|
||||
repo_naddrs: &[Coordinate],
|
||||
) -> N34Result<Vec<GitRepositoryAnnouncement>> {
|
||||
future::join_all(repo_naddrs.iter().map(|c| {
|
||||
async {
|
||||
self.fetch_event(
|
||||
Filter::new()
|
||||
.author(c.public_key)
|
||||
.identifier(&c.identifier)
|
||||
.kind(Kind::GitRepoAnnouncement),
|
||||
)
|
||||
.await?
|
||||
.map(|e| utils::event_into_repo(e, &c.identifier))
|
||||
.ok_or(N34Error::NotFoundRepo)
|
||||
}
|
||||
}))
|
||||
.await
|
||||
.into_iter()
|
||||
.collect()
|
||||
}
|
||||
|
||||
/// Finds the root issue or patch for a given event. If the event is already
|
||||
|
||||
Reference in New Issue
Block a user