-
Notifications
You must be signed in to change notification settings - Fork 75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: implement dismissed events bucket #587
Conversation
Co-authored-by: Lachezar Lechev <[email protected]>
Co-authored-by: Lachezar Lechev <[email protected]>
src/models/ctx/update_events.rs
Outdated
Some(GetNotificationResponse { id, .. }) | ||
if !dismissed_events.items.contains_key(id) => | ||
{ | ||
eq_update( | ||
&mut events.notification, | ||
Loadable::Ready(response.to_owned()), | ||
) | ||
} | ||
_ => eq_update( | ||
&mut events.notification, | ||
Loadable::Ready(response.to_owned()), | ||
), | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- case that is not handled: Event that's dismissed should not result to
Loadable::Ready
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The request was successful so it's Ready, not loading, not an error
If it was dismissed, it returns None
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How often we will call the GetEvents
? We might need to add a timeout for making the requests e.g. every 6 or 12 hours at most.
src/models/ctx/update_events.rs
Outdated
Some(GetModalResponse { id, .. }) if !dismissed_events.items.contains_key(id) => { | ||
eq_update(&mut events.modal, Loadable::Ready(response.to_owned())) | ||
} | ||
_ => eq_update(&mut events.modal, Loadable::Ready(response.to_owned())), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same for this match. Both match arms are equal and we need to handle the case where we have dismissed the Modal
- fix match
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check the test, if the modal was dismissed, events.modal
will be Loadable:Ready(None)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can put explicitly Loadable::Ready(None) if you prefer
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No you are absolutely right, will fix that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks great
No description provided.