UI menu option to post again

This commit is contained in:
Mike Dilger 2024-02-26 08:14:28 +13:00
parent aeaa679be3
commit caf6d21a48

View File

@ -16,7 +16,7 @@ use egui::{
use gossip_lib::comms::ToOverlordMessage;
use gossip_lib::DmChannel;
use gossip_lib::FeedKind;
use gossip_lib::{ZapState, GLOBALS};
use gossip_lib::{Globals, ZapState, GLOBALS};
use nostr_types::{
Event, EventAddr, EventDelegation, EventKind, EventPointer, EventReference, IdHex, NostrUrl,
UncheckedUrl,
@ -522,6 +522,28 @@ fn render_note_inner(
*keep_open = false;
}
}
// Chance to post our note again to relays it missed
if let Some(our_pubkey) = GLOBALS.identity.public_key() {
if note.event.pubkey == our_pubkey {
if let Ok(broadcast_relays) = Globals::relays_for_event(&note.event)
{
if !broadcast_relays.is_empty() {
if ui
.button(&format!(
"Post again ({})",
broadcast_relays.len()
))
.clicked()
{
let _ = GLOBALS.to_overlord.send(
ToOverlordMessage::PostAgain(note.event.clone()),
);
*keep_open = false;
}
}
}
}
}
if ui.button("Rerender").clicked() {
app.notes.cache_invalidate_note(&note.event.id);
*keep_open = false;