remove cards that have no associated notifications

This commit is contained in:
Ashley Wulber 2023-07-21 12:08:33 -04:00 committed by Ashley Wulber
parent 97e82e1299
commit 6ff3e669de

View file

@ -249,10 +249,12 @@ impl Application for Notifications {
Command::none() Command::none()
} }
Message::Dismissed(id) => { Message::Dismissed(id) => {
info!("dismissed {}", id); info!("Dismissed {}", id);
for c in &mut self.cards { for c in &mut self.cards {
c.1.retain(|n| n.id != id); c.1.retain(|n| n.id != id);
} }
self.cards.retain(|c| !c.1.is_empty());
if let Some(tx) = &self.dbus_sender { if let Some(tx) = &self.dbus_sender {
let tx = tx.clone(); let tx = tx.clone();
tokio::spawn(async move { tokio::spawn(async move {