mirror of
https://github.com/mikedilger/gossip.git
synced 2024-09-19 19:46:50 +00:00
Revert "Update metadata button (under a menu so it's not too easy to click often)"
This reverts commit 605fa54a37
.
This commit is contained in:
parent
605fa54a37
commit
f89b403beb
@ -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<PublicKeyHex> = GLOBALS.people.read().await
|
||||
.get_all().iter().map(|p| p.pubkey.clone()).collect();
|
||||
|
||||
// Get all relays we are connected to
|
||||
let r: Vec<String> = 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<String, Vec<PublicKeyHex>> = 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(),
|
||||
});
|
||||
}
|
||||
}
|
||||
_ => {}
|
||||
},
|
||||
_ => {}
|
||||
|
@ -195,7 +195,7 @@ impl People {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_all(&self) -> Vec<DbPerson> {
|
||||
pub fn get_all(&mut self) -> Vec<DbPerson> {
|
||||
let mut v: Vec<DbPerson> = self.people.values().map(|p| p.to_owned()).collect();
|
||||
v.sort_by(|a, b| {
|
||||
let c = a.name.cmp(&b.name);
|
||||
|
@ -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()
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user