From f89b403bebbbd679d3002ff0c145755da581be32 Mon Sep 17 00:00:00 2001 From: Mike Dilger Date: Mon, 2 Jan 2023 21:23:38 +1300 Subject: [PATCH] Revert "Update metadata button (under a menu so it's not too easy to click often)" This reverts commit 605fa54a370807e3a6049a065ec0d9ffa693b928. --- src/overlord/mod.rs | 37 ------------------------------------- src/people.rs | 2 +- src/ui/feed.rs | 40 +++++++++++++--------------------------- 3 files changed, 14 insertions(+), 65 deletions(-) diff --git a/src/overlord/mod.rs b/src/overlord/mod.rs index f9834f09..c242a0d4 100644 --- a/src/overlord/mod.rs +++ b/src/overlord/mod.rs @@ -524,43 +524,6 @@ impl Overlord { DbRelay::insert(dbrelay).await?; } } - "update_metadata" => { - tracing::debug!("Overlord got update_metadata request"); - - // Get all people we are rendering - let v: Vec = GLOBALS.people.read().await - .get_all().iter().map(|p| p.pubkey.clone()).collect(); - - // Get all relays we are connected to - let r: Vec = self.urls_watching.iter().map(|u| u.inner().to_owned()).collect(); - - // Match up people with relays, sorted into per-relay buckets - let matching = DbPersonRelay::fetch_matching(v.clone(), r.clone()).await?; - let mut by_relay: HashMap> = HashMap::new(); - for person_relay in matching.iter() { - let pkh = PublicKeyHex(person_relay.person.clone()); - by_relay.entry(person_relay.relay.clone()) - .and_modify(|v| v.push(pkh.clone())) - .or_insert_with(|| { - vec![pkh] - }); - } - - // Tell each minion in turn to subscribe to ephemeral data for all - // the people we are watching that use that relay - for (relay, people) in by_relay.iter() { - - tracing::debug!("Overlord asking {} to update metadata for {} people", - &relay, people.len()); - - // "subscribe_ephemeral_for_all" - let _ = self.to_minions.send(BusMessage { - target: relay.to_string(), - kind: "subscribe_ephemeral_for_all".to_string(), - json_payload: serde_json::to_string(people).unwrap(), - }); - } - } _ => {} }, _ => {} diff --git a/src/people.rs b/src/people.rs index 92d1ee7e..c57f2588 100644 --- a/src/people.rs +++ b/src/people.rs @@ -195,7 +195,7 @@ impl People { } } - pub fn get_all(&self) -> Vec { + pub fn get_all(&mut self) -> Vec { let mut v: Vec = self.people.values().map(|p| p.to_owned()).collect(); v.sort_by(|a, b| { let c = a.name.cmp(&b.name); diff --git a/src/ui/feed.rs b/src/ui/feed.rs index 218506b1..2abdef3d 100644 --- a/src/ui/feed.rs +++ b/src/ui/feed.rs @@ -31,35 +31,21 @@ pub(super) fn update(app: &mut GossipUi, ctx: &Context, frame: &mut eframe::Fram }; ui.with_layout(Layout::right_to_left(Align::TOP), |ui| { - - ui.menu_button("Query", |ui| { - if ui.button("Missing Events") - .on_hover_text("Query Relays for Missing Events") - .clicked() - { - let _ = GLOBALS.to_overlord.send(BusMessage { - target: "overlord".to_string(), - kind: "get_missing_events".to_string(), - json_payload: serde_json::to_string("").unwrap(), - }); - } - - if ui.button("Metadata") - .on_hover_text("Metadata and contact lists for everyone in the feed") - .clicked() - { - let _ = GLOBALS.to_overlord.send(BusMessage { - target: "overlord".to_string(), - kind: "update_metadata".to_string(), - json_payload: serde_json::to_string("").unwrap(), - }); - } - }); - - ui.label(&format!("Missing={}", desired_count)); + if ui + .button(&format!("QM {}", desired_count)) + .on_hover_text("Query Relays for Missing Events") + .clicked() + { + let tx = GLOBALS.to_overlord.clone(); + let _ = tx.send(BusMessage { + target: "overlord".to_string(), + kind: "get_missing_events".to_string(), + json_payload: serde_json::to_string("").unwrap(), + }); + } if ui - .button(&format!("Process={}", incoming_count)) + .button(&format!("PQ {}", incoming_count)) .on_hover_text("Process Queue of Incoming Events") .clicked() {