diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2024-12-09 15:35:18 +0000 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2024-12-09 15:35:18 +0000 |
| commit | d8f4f7641312bff32f772cbc070b3f99ced0c8fe (patch) | |
| tree | 0ca4db7b41d7c191eb91ceb1c8124b5e659a3566 /src/lib/login/user.rs | |
| parent | f0d0e1ba1cba11d3a98a5ab0c7f1dc72b6bc4e17 (diff) | |
fix: fetch user relays for `send`,`push` & `init`
get the latest user relay list before pushing patches and repo
announcement events
Diffstat (limited to 'src/lib/login/user.rs')
| -rw-r--r-- | src/lib/login/user.rs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/lib/login/user.rs b/src/lib/login/user.rs index 1898a1f..c13cdf5 100644 --- a/src/lib/login/user.rs +++ b/src/lib/login/user.rs | |||
| @@ -60,8 +60,23 @@ pub async fn get_user_details( | |||
| 60 | #[cfg(not(test))] client: Option<&Client>, | 60 | #[cfg(not(test))] client: Option<&Client>, |
| 61 | git_repo_path: Option<&Path>, | 61 | git_repo_path: Option<&Path>, |
| 62 | cache_only: bool, | 62 | cache_only: bool, |
| 63 | fetch_profile_updates: bool, | ||
| 63 | ) -> Result<UserRef> { | 64 | ) -> Result<UserRef> { |
| 64 | if let Ok(user_ref) = get_user_ref_from_cache(git_repo_path, public_key).await { | 65 | if let Ok(user_ref) = get_user_ref_from_cache(git_repo_path, public_key).await { |
| 66 | if fetch_profile_updates { | ||
| 67 | if let Some(client) = client { | ||
| 68 | let term = console::Term::stderr(); | ||
| 69 | term.write_line("searching for profile updates...")?; | ||
| 70 | let (reports, progress_reporter) = client | ||
| 71 | .fetch_all(git_repo_path, None, &HashSet::from_iter(vec![*public_key])) | ||
| 72 | .await?; | ||
| 73 | if !reports.iter().any(|r| r.is_err()) { | ||
| 74 | progress_reporter.clear()?; | ||
| 75 | term.clear_last_lines(1)?; | ||
| 76 | } | ||
| 77 | return get_user_ref_from_cache(git_repo_path, public_key).await; | ||
| 78 | } | ||
| 79 | } | ||
| 65 | Ok(user_ref) | 80 | Ok(user_ref) |
| 66 | } else { | 81 | } else { |
| 67 | let empty = UserRef { | 82 | let empty = UserRef { |