diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2024-11-29 16:09:38 +0000 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2024-11-29 16:57:46 +0000 |
| commit | 8c763d0483309c85a32a7f4a20ba0279083ee40f (patch) | |
| tree | 47c5dc7f5778760dc99804a7918be81ab383e778 /src/lib/client.rs | |
| parent | 9b3b242652bf7c1ad638ff0f64f1d59aef7fe0ad (diff) | |
feat(init): set remote `origin`
check whether remote `origin` is nostr url and if not attempt
to set it.
Diffstat (limited to 'src/lib/client.rs')
| -rw-r--r-- | src/lib/client.rs | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src/lib/client.rs b/src/lib/client.rs index 534eb9e..cd9a75c 100644 --- a/src/lib/client.rs +++ b/src/lib/client.rs | |||
| @@ -832,7 +832,13 @@ pub async fn get_repo_ref_from_cache( | |||
| 832 | ] | 832 | ] |
| 833 | .concat(); | 833 | .concat(); |
| 834 | for e in events { | 834 | for e in events { |
| 835 | if let Ok(repo_ref) = RepoRef::try_from(e.clone()) { | 835 | if let Ok(repo_ref) = RepoRef::try_from(( |
| 836 | e.clone(), | ||
| 837 | repo_coordinates | ||
| 838 | .iter() | ||
| 839 | .next() | ||
| 840 | .map(|coordinate| coordinate.public_key), | ||
| 841 | )) { | ||
| 836 | for m in repo_ref.maintainers { | 842 | for m in repo_ref.maintainers { |
| 837 | if maintainers.insert(m) { | 843 | if maintainers.insert(m) { |
| 838 | new_coordinate = true; | 844 | new_coordinate = true; |
| @@ -846,12 +852,16 @@ pub async fn get_repo_ref_from_cache( | |||
| 846 | } | 852 | } |
| 847 | } | 853 | } |
| 848 | repo_events.sort_by_key(|e| e.created_at); | 854 | repo_events.sort_by_key(|e| e.created_at); |
| 849 | let repo_ref = RepoRef::try_from( | 855 | let repo_ref = RepoRef::try_from(( |
| 850 | repo_events | 856 | repo_events |
| 851 | .first() | 857 | .first() |
| 852 | .context("no repo events at specified coordinates")? | 858 | .context("no repo events at specified coordinates")? |
| 853 | .clone(), | 859 | .clone(), |
| 854 | )?; | 860 | repo_coordinates |
| 861 | .iter() | ||
| 862 | .next() | ||
| 863 | .map(|coordinate| coordinate.public_key), | ||
| 864 | ))?; | ||
| 855 | 865 | ||
| 856 | let mut events: HashMap<Coordinate, nostr::Event> = HashMap::new(); | 866 | let mut events: HashMap<Coordinate, nostr::Event> = HashMap::new(); |
| 857 | for m in &maintainers { | 867 | for m in &maintainers { |
| @@ -1179,7 +1189,7 @@ async fn process_fetched_events( | |||
| 1179 | )); | 1189 | )); |
| 1180 | } | 1190 | } |
| 1181 | // if contains new maintainer | 1191 | // if contains new maintainer |
| 1182 | if let Ok(repo_ref) = &RepoRef::try_from(event.clone()) { | 1192 | if let Ok(repo_ref) = &RepoRef::try_from((event.clone(), None)) { |
| 1183 | for m in &repo_ref.maintainers { | 1193 | for m in &repo_ref.maintainers { |
| 1184 | if !request | 1194 | if !request |
| 1185 | .repo_coordinates_without_relays // prexisting maintainers | 1195 | .repo_coordinates_without_relays // prexisting maintainers |