feat(action-items): cancel reminders for deleted items on confirm
This commit is contained in:
@@ -2727,6 +2727,23 @@ pub async fn confirm_action_items(
|
||||
meeting_id: MeetingId,
|
||||
items: Vec<ActionItem>,
|
||||
) -> WaResult<()> {
|
||||
// Cancel reminders for items the user deleted (present in the table but no
|
||||
// longer in the incoming list) — save_action_items drops the rows, but the
|
||||
// scheduled OS reminder is separate state (T8.6, FR-CAL-5).
|
||||
let existing = state
|
||||
.store
|
||||
.list_action_items(&meeting_id)
|
||||
.await
|
||||
.map_err(|e| WaError::new("storage", e.to_string()))?;
|
||||
let keep: std::collections::HashSet<&str> =
|
||||
items.iter().filter_map(|i| i.id.as_deref()).collect();
|
||||
for old in &existing {
|
||||
if let Some(id) = &old.id {
|
||||
if !keep.contains(id.as_str()) {
|
||||
crate::reminders::cancel(id);
|
||||
}
|
||||
}
|
||||
}
|
||||
let saved = state
|
||||
.store
|
||||
.save_action_items(&meeting_id, &items)
|
||||
@@ -4415,6 +4432,7 @@ mod tests {
|
||||
calendar_event_id: None,
|
||||
tags: Vec::new(),
|
||||
template_id: None,
|
||||
action_items: Vec::new(),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user