forked from treehouse/mastodon
[Glitch] Fix mark as read in notifications to be saved immediately
Port bec8b12bb5
to glitch-soc
Signed-off-by: Thibaut Girka <thib@sitedethib.com>
signup-info-prompt
parent
c3d82027cf
commit
8071613dd7
|
@ -100,8 +100,12 @@ export function submitMarkersSuccess({ home, notifications }) {
|
|||
};
|
||||
};
|
||||
|
||||
export function submitMarkers() {
|
||||
return (dispatch, getState) => debouncedSubmitMarkers(dispatch, getState);
|
||||
export function submitMarkers(params = {}) {
|
||||
const result = (dispatch, getState) => debouncedSubmitMarkers(dispatch, getState);
|
||||
if (params.immediate === true) {
|
||||
debouncedSubmitMarkers.flush();
|
||||
}
|
||||
return result;
|
||||
};
|
||||
|
||||
export const fetchMarkers = () => (dispatch, getState) => {
|
||||
|
|
|
@ -71,7 +71,7 @@ const mapDispatchToProps = dispatch => ({
|
|||
},
|
||||
onMarkAsRead() {
|
||||
dispatch(markNotificationsAsRead());
|
||||
dispatch(submitMarkers());
|
||||
dispatch(submitMarkers({ immediate: true }));
|
||||
},
|
||||
onMount() {
|
||||
dispatch(mountNotifications());
|
||||
|
|
|
@ -359,7 +359,7 @@ class UI extends React.Component {
|
|||
const visibility = !document[this.visibilityHiddenProp];
|
||||
this.props.dispatch(notificationsSetVisibility(visibility));
|
||||
if (visibility) {
|
||||
this.props.dispatch(submitMarkers());
|
||||
this.props.dispatch(submitMarkers({ immediate: true }));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue