mirror of
https://github.com/mikedilger/gossip.git
synced 2024-09-29 08:21:47 +00:00
Cache-invalidate all posts by a given author when toggling mute
This commit is contained in:
parent
db460338bc
commit
1d09e35737
@ -206,11 +206,25 @@ impl Notes {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
/// Drop NoteData objects that do not have a
|
||||
/// correlated event in the event cache
|
||||
pub(super) fn drop_uncached_events(&mut self) {
|
||||
pub(super) fn cache_invalidate_missing_events(&mut self) {
|
||||
self.notes.retain(|id,_| GLOBALS.events.contains_key(id));
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
/// Drop NoteData for a specific note
|
||||
pub(super) fn cache_invalidate_note(&mut self, id: &Id) {
|
||||
self.notes.remove(id);
|
||||
}
|
||||
*/
|
||||
|
||||
/// Drop all NoteData for a given person
|
||||
pub(in crate::ui) fn cache_invalidate_person(&mut self, pubkey: &PublicKeyHex) {
|
||||
self.notes.retain(|_,note| note.borrow().author.pubkey != *pubkey);
|
||||
}
|
||||
|
||||
pub(super) fn try_update_and_get(&mut self, id: &Id) -> Option<Rc<RefCell<NoteData>>> {
|
||||
if self.notes.contains_key(id) {
|
||||
|
@ -623,6 +623,7 @@ impl GossipUi {
|
||||
let mute_label = if person.muted == 1 { "Unmute" } else { "Mute" };
|
||||
if ui.button(mute_label).clicked() {
|
||||
GLOBALS.people.mute(&person.pubkey, person.muted == 0);
|
||||
app.notes.cache_invalidate_person(&person.pubkey);
|
||||
}
|
||||
if person.followed == 0 && ui.button("Follow").clicked() {
|
||||
GLOBALS.people.follow(&person.pubkey, true);
|
||||
|
Loading…
Reference in New Issue
Block a user