[Glitch] Fix mark as read in notifications to be saved immediately
Port ffa5aa294e
to glitch-soc
Signed-off-by: Thibaut Girka <thib@sitedethib.com>
This commit is contained in:
parent
004728ce96
commit
7c5bc01eca
3 changed files with 8 additions and 4 deletions
|
@ -100,8 +100,12 @@ export function submitMarkersSuccess({ home, notifications }) {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
export function submitMarkers() {
|
export function submitMarkers(params = {}) {
|
||||||
return (dispatch, getState) => debouncedSubmitMarkers(dispatch, getState);
|
const result = (dispatch, getState) => debouncedSubmitMarkers(dispatch, getState);
|
||||||
|
if (params.immediate === true) {
|
||||||
|
debouncedSubmitMarkers.flush();
|
||||||
|
}
|
||||||
|
return result;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const fetchMarkers = () => (dispatch, getState) => {
|
export const fetchMarkers = () => (dispatch, getState) => {
|
||||||
|
|
|
@ -71,7 +71,7 @@ const mapDispatchToProps = dispatch => ({
|
||||||
},
|
},
|
||||||
onMarkAsRead() {
|
onMarkAsRead() {
|
||||||
dispatch(markNotificationsAsRead());
|
dispatch(markNotificationsAsRead());
|
||||||
dispatch(submitMarkers());
|
dispatch(submitMarkers({ immediate: true }));
|
||||||
},
|
},
|
||||||
onMount() {
|
onMount() {
|
||||||
dispatch(mountNotifications());
|
dispatch(mountNotifications());
|
||||||
|
|
|
@ -359,7 +359,7 @@ class UI extends React.Component {
|
||||||
const visibility = !document[this.visibilityHiddenProp];
|
const visibility = !document[this.visibilityHiddenProp];
|
||||||
this.props.dispatch(notificationsSetVisibility(visibility));
|
this.props.dispatch(notificationsSetVisibility(visibility));
|
||||||
if (visibility) {
|
if (visibility) {
|
||||||
this.props.dispatch(submitMarkers());
|
this.props.dispatch(submitMarkers({ immediate: true }));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue