From a5216602749bff55c2773acce098c91942cd3920 Mon Sep 17 00:00:00 2001 From: DanConwayDev Date: Wed, 28 Aug 2024 14:20:34 +0100 Subject: chore: bump rust-nostr to v0.34.0 bump all rust-nostr packages I'm not sure I'm completely happy with allowing mutable_key_type but it is just run inside tests it appears that Event didn't have the Copy trait in v0.33.0 so I'm not sure why this warning suddenly appeared the timeout of client.get_events_of needed to be doubled which could indicate that an ineffiency has been introduced in v0.34.0 the primary motivation for upgrading now was to get this fix: nostr:nevent1qqsffl2ld678pjj77rh9k2g4edljmxdu6ew4lvgnglxv7jhu3ru8vvcpp4mhxue69uhkummn9ekx7mqzyzsq3hh327t0h2dq6matqn5064cgj2zanl2stkj6s0lg4t2h5dty6rm2ucm as I suspect it is also effecting other repositories eg nostr-profile-manager --- src/client.rs | 4 ++-- src/git_remote_helper.rs | 3 ++- src/sub_commands/list.rs | 7 ++++--- src/sub_commands/send.rs | 18 +++++++++++++----- 4 files changed, 21 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/client.rs b/src/client.rs index db41f99..abde217 100644 --- a/src/client.rs +++ b/src/client.rs @@ -1182,12 +1182,12 @@ async fn process_fetched_events( } else if [Kind::RelayList, Kind::Metadata].contains(&event.kind()) { if request .missing_contributor_profiles - .contains(event.author_ref()) + .contains(&event.author()) { report.contributor_profiles.insert(event.author()); } else if let Some((_, (metadata_timestamp, relay_list_timestamp))) = request .profiles_to_fetch_from_user_relays - .get_key_value(event.author_ref()) + .get_key_value(&event.author()) { if (Kind::Metadata.eq(&event.kind()) && event.created_at().gt(metadata_timestamp)) diff --git a/src/git_remote_helper.rs b/src/git_remote_helper.rs index 2244383..4d34850 100644 --- a/src/git_remote_helper.rs +++ b/src/git_remote_helper.rs @@ -366,7 +366,8 @@ async fn get_open_proposals( .iter() .filter(|e| { status_kinds().contains(&e.kind()) - && e.iter_tags() + && e.tags() + .iter() .any(|t| t.as_vec()[1].eq(&proposal.id.to_string())) }) .collect::>() diff --git a/src/sub_commands/list.rs b/src/sub_commands/list.rs index 73ef107..ac1f4ab 100644 --- a/src/sub_commands/list.rs +++ b/src/sub_commands/list.rs @@ -78,7 +78,8 @@ pub async fn launch() -> Result<()> { .iter() .filter(|e| { status_kinds().contains(&e.kind()) - && e.iter_tags() + && e.tags() + .iter() .any(|t| t.as_vec()[1].eq(&proposal.id.to_string())) }) .collect::>() @@ -873,7 +874,7 @@ pub async fn get_all_proposal_patch_events_from_cache( .iter() .copied() .collect(); - commit_events.retain(|e| permissioned_users.contains(e.author_ref())); + commit_events.retain(|e| permissioned_users.contains(&e.author())); let revision_roots: HashSet = commit_events .iter() @@ -899,7 +900,7 @@ pub async fn get_all_proposal_patch_events_from_cache( Ok(commit_events .iter() - .filter(|e| !event_is_cover_letter(e) && permissioned_users.contains(e.author_ref())) + .filter(|e| !event_is_cover_letter(e) && permissioned_users.contains(&e.author())) .cloned() .collect()) } diff --git a/src/sub_commands/send.rs b/src/sub_commands/send.rs index 8369b10..3c4df9d 100644 --- a/src/sub_commands/send.rs +++ b/src/sub_commands/send.rs @@ -806,8 +806,11 @@ pub fn event_is_cover_letter(event: &nostr::Event) -> bool { // [PATCH v1 0/n ] or // [PATCH subsystem v2 0/n ] event.kind.eq(&Kind::GitPatch) - && event.iter_tags().any(|t| t.as_vec()[1].eq("root")) - && event.iter_tags().any(|t| t.as_vec()[1].eq("cover-letter")) + && event.tags().iter().any(|t| t.as_vec()[1].eq("root")) + && event + .tags() + .iter() + .any(|t| t.as_vec()[1].eq("cover-letter")) } pub fn commit_msg_from_patch(patch: &nostr::Event) -> Result { @@ -876,17 +879,22 @@ pub fn event_to_cover_letter(event: &nostr::Event) -> Result { } pub fn event_is_patch_set_root(event: &nostr::Event) -> bool { - event.kind.eq(&Kind::GitPatch) && event.iter_tags().any(|t| t.as_vec()[1].eq("root")) + event.kind.eq(&Kind::GitPatch) && event.tags().iter().any(|t| t.as_vec()[1].eq("root")) } pub fn event_is_revision_root(event: &nostr::Event) -> bool { - event.kind.eq(&Kind::GitPatch) && event.iter_tags().any(|t| t.as_vec()[1].eq("revision-root")) + event.kind.eq(&Kind::GitPatch) + && event + .tags() + .iter() + .any(|t| t.as_vec()[1].eq("revision-root")) } pub fn patch_supports_commit_ids(event: &nostr::Event) -> bool { event.kind.eq(&Kind::GitPatch) && event - .iter_tags() + .tags() + .iter() .any(|t| t.as_vec()[0].eq("commit-pgp-sig")) } -- cgit v1.2.3