diff options
Diffstat (limited to 'src/lib/repo_ref.rs')
| -rw-r--r-- | src/lib/repo_ref.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/lib/repo_ref.rs b/src/lib/repo_ref.rs index bf52cda..78968b4 100644 --- a/src/lib/repo_ref.rs +++ b/src/lib/repo_ref.rs | |||
| @@ -42,6 +42,8 @@ pub struct RepoRef { | |||
| 42 | pub blossoms: Vec<Url>, | 42 | pub blossoms: Vec<Url>, |
| 43 | pub maintainers: Vec<PublicKey>, | 43 | pub maintainers: Vec<PublicKey>, |
| 44 | pub trusted_maintainer: PublicKey, | 44 | pub trusted_maintainer: PublicKey, |
| 45 | // set to None if not known | ||
| 46 | pub maintainers_without_annoucnement: Option<Vec<PublicKey>>, | ||
| 45 | pub events: HashMap<Nip19Coordinate, nostr::Event>, | 47 | pub events: HashMap<Nip19Coordinate, nostr::Event>, |
| 46 | pub nostr_git_url: Option<NostrUrlDecoded>, | 48 | pub nostr_git_url: Option<NostrUrlDecoded>, |
| 47 | } | 49 | } |
| @@ -49,6 +51,11 @@ pub struct RepoRef { | |||
| 49 | impl TryFrom<(nostr::Event, Option<PublicKey>)> for RepoRef { | 51 | impl TryFrom<(nostr::Event, Option<PublicKey>)> for RepoRef { |
| 50 | type Error = anyhow::Error; | 52 | type Error = anyhow::Error; |
| 51 | 53 | ||
| 54 | /* | ||
| 55 | * this could do with a refactor to intergrate enhancements made by | ||
| 56 | * `get_repo_ref_from_cache`. Other than tests, its only used there and the | ||
| 57 | * changes made by that function are important. | ||
| 58 | */ | ||
| 52 | fn try_from((event, trusted_maintainer): (nostr::Event, Option<PublicKey>)) -> Result<Self> { | 59 | fn try_from((event, trusted_maintainer): (nostr::Event, Option<PublicKey>)) -> Result<Self> { |
| 53 | // TODO: turn trusted maintainer into NostrUrlDecoded | 60 | // TODO: turn trusted maintainer into NostrUrlDecoded |
| 54 | if !event.kind.eq(&Kind::GitRepoAnnouncement) { | 61 | if !event.kind.eq(&Kind::GitRepoAnnouncement) { |
| @@ -66,6 +73,7 @@ impl TryFrom<(nostr::Event, Option<PublicKey>)> for RepoRef { | |||
| 66 | blossoms: Vec::new(), | 73 | blossoms: Vec::new(), |
| 67 | maintainers: Vec::new(), | 74 | maintainers: Vec::new(), |
| 68 | trusted_maintainer: trusted_maintainer.unwrap_or(event.pubkey), | 75 | trusted_maintainer: trusted_maintainer.unwrap_or(event.pubkey), |
| 76 | maintainers_without_annoucnement: None, | ||
| 69 | events: HashMap::new(), | 77 | events: HashMap::new(), |
| 70 | nostr_git_url: None, | 78 | nostr_git_url: None, |
| 71 | }; | 79 | }; |
| @@ -740,6 +748,7 @@ mod tests { | |||
| 740 | ], | 748 | ], |
| 741 | blossoms: vec![], | 749 | blossoms: vec![], |
| 742 | trusted_maintainer: TEST_KEY_1_KEYS.public_key(), | 750 | trusted_maintainer: TEST_KEY_1_KEYS.public_key(), |
| 751 | maintainers_without_annoucnement: None, | ||
| 743 | maintainers: vec![TEST_KEY_1_KEYS.public_key(), TEST_KEY_2_KEYS.public_key()], | 752 | maintainers: vec![TEST_KEY_1_KEYS.public_key(), TEST_KEY_2_KEYS.public_key()], |
| 744 | events: HashMap::new(), | 753 | events: HashMap::new(), |
| 745 | nostr_git_url: None, | 754 | nostr_git_url: None, |