Skip to content

Commit

Permalink
feat: when you remove a Lib.Item dismiss notifs
Browse files Browse the repository at this point in the history
Signed-off-by: Lachezar Lechev <[email protected]>
  • Loading branch information
elpiel committed Aug 11, 2023
1 parent edac44c commit 33bbdad
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/models/ctx/update_library.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,19 @@ pub fn update_library<E: Env + 'static>(
let mut library_item = library_item.to_owned();
library_item.removed = true;
library_item.temp = false;

// Dismiss any notification for the LibraryItem
let notifications_effects = if library_item.state.no_notif {
Effects::msg(Msg::Internal(Internal::DismissNotificationItem(
id.to_owned(),
)))
.unchanged()
} else {
Effects::none().unchanged()
};

Effects::msg(Msg::Internal(Internal::UpdateLibraryItem(library_item)))
.join(notifications_effects)
.join(Effects::msg(Msg::Event(Event::LibraryItemRemoved {
id: id.to_owned(),
})))
Expand Down

0 comments on commit 33bbdad

Please sign in to comment.