fix settings

This commit is contained in:
2026-06-10 14:51:44 +07:00
parent 5edc8d311e
commit e95cc5967f
2 changed files with 10 additions and 12 deletions

View File

@@ -282,19 +282,16 @@ impl RelayAuth {
// Clear pending events for the authenticated relay // Clear pending events for the authenticated relay
this.clear_pending_events(url, cx); this.clear_pending_events(url, cx);
// Only show the success notification if the relay was not already trusted
if !settings.read(cx).trusted_relay(url, cx) {
let domain = url.domain().unwrap_or_default(); let domain = url.domain().unwrap_or_default();
let msg = format!("Relay {} has been authenticated", domain); let msg = format!("Relay {} has been authenticated", domain);
window.push_notification(Notification::success(msg), cx); window.push_notification(Notification::success(msg), cx);
} else {
// Save the authenticated relay to automatically authenticate future requests // Save the authenticated relay to automatically authenticate future requests
settings.update(cx, |this, cx| { settings.update(cx, |this, cx| {
this.add_trusted_relay(url, cx); this.add_trusted_relay(url, cx);
}); });
} }
}
}) })
.ok(); .ok();
}) })

View File

@@ -327,7 +327,8 @@ impl AppSettings {
.iter() .iter()
.any(|relay| relay == url.as_str_without_trailing_slash()) .any(|relay| relay == url.as_str_without_trailing_slash())
{ {
this.trusted_relays.push(url.to_string()); this.trusted_relays
.push(url.as_str_without_trailing_slash().to_string());
cx.notify(); cx.notify();
} }
}); });