From a67cb7c387d749de3d179f0d3bc0eb84f806d860 Mon Sep 17 00:00:00 2001 From: Mike Dilger Date: Wed, 18 Oct 2023 17:28:17 +1300 Subject: [PATCH] Fix wizard panic on deleting purplepag.es --- gossip-bin/src/ui/wizard/setup_relays.rs | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/gossip-bin/src/ui/wizard/setup_relays.rs b/gossip-bin/src/ui/wizard/setup_relays.rs index 140d77cc4..a78e0dbbb 100644 --- a/gossip-bin/src/ui/wizard/setup_relays.rs +++ b/gossip-bin/src/ui/wizard/setup_relays.rs @@ -53,22 +53,12 @@ pub(super) fn update(app: &mut GossipUi, _ctx: &Context, _frame: &mut eframe::Fr .cloned() .collect(); - let mut discovery_relays: Vec = relays + let discovery_relays: Vec = relays .iter() .filter(|relay| relay.has_usage_bits(Relay::DISCOVER)) .cloned() .collect(); - if !discovery_relays - .iter() - .any(|r| r.url.as_str() == "wss://purplepag.es/") - { - let mut purple_pages = read_relay(&RelayUrl::try_from_str("wss://purplepag.es/").unwrap()); - purple_pages.set_usage_bits(Relay::DISCOVER); - let _ = GLOBALS.storage.write_relay(&purple_pages, None); - discovery_relays.push(purple_pages); - } - let mut need_more = false; ui.add_space(20.0); @@ -141,7 +131,9 @@ pub(super) fn update(app: &mut GossipUi, _ctx: &Context, _frame: &mut eframe::Fr for relay in discovery_relays.iter() { ui.horizontal(|ui| { if ui.button("🗑").clicked() { - unimplemented!(); + let mut r = relay.clone(); + r.clear_usage_bits(Relay::DISCOVER | Relay::ADVERTISE); + let _ = GLOBALS.storage.write_relay(&r, None); } ui.label(relay.url.as_str()); });