Get event after Add button is pressed to make sure it is up to date.
Closes: #296 Changelog-Fixed: Fixed issue with relays not keeping in sync when adding
This commit is contained in:
committed by
William Casarin
parent
43cc3b6b6b
commit
35ae69740a
@@ -28,14 +28,17 @@ struct RecommendedRelayView: View {
|
||||
HStack {
|
||||
Text(relay)
|
||||
Spacer()
|
||||
if let ev = damus.contacts.event, add_button {
|
||||
if add_button {
|
||||
if let privkey = damus.keypair.privkey {
|
||||
Button(NSLocalizedString("Add", comment: "Button to add recommended relay server.")) {
|
||||
guard let ev = add_relay(ev: ev, privkey: privkey, current_relays: damus.pool.descriptors, relay: relay, info: .rw) else {
|
||||
guard let ev_before_add = damus.contacts.event else {
|
||||
return
|
||||
}
|
||||
process_contact_event(pool: damus.pool, contacts: damus.contacts, pubkey: damus.pubkey, ev: ev)
|
||||
damus.pool.send(.event(ev))
|
||||
guard let ev_after_add = add_relay(ev: ev_before_add, privkey: privkey, current_relays: damus.pool.descriptors, relay: relay, info: .rw) else {
|
||||
return
|
||||
}
|
||||
process_contact_event(pool: damus.pool, contacts: damus.contacts, pubkey: damus.pubkey, ev: ev_after_add)
|
||||
damus.pool.send(.event(ev_after_add))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user