Fix mark as read in notifications to be saved immediately (#14907)

* Fix mark as read in notifications to be saved immediately

* fix code style
lolsob-rspec
Takeshi Umeda 2020-10-01 11:17:46 +09:00 committed by GitHub
parent cbdbe3699c
commit ffa5aa294e
3 changed files with 9 additions and 3 deletions

View File

@ -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) => {

View File

@ -12,6 +12,7 @@ import {
unmountNotifications, unmountNotifications,
markNotificationsAsRead, markNotificationsAsRead,
} from '../../actions/notifications'; } from '../../actions/notifications';
import { submitMarkers } from '../../actions/markers';
import { addColumn, removeColumn, moveColumn } from '../../actions/columns'; import { addColumn, removeColumn, moveColumn } from '../../actions/columns';
import NotificationContainer from './containers/notification_container'; import NotificationContainer from './containers/notification_container';
import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; import { defineMessages, injectIntl, FormattedMessage } from 'react-intl';
@ -162,6 +163,7 @@ class Notifications extends React.PureComponent {
handleMarkAsRead = () => { handleMarkAsRead = () => {
this.props.dispatch(markNotificationsAsRead()); this.props.dispatch(markNotificationsAsRead());
this.props.dispatch(submitMarkers({ immediate: true }));
}; };
render () { render () {

View File

@ -266,7 +266,7 @@ class UI extends React.PureComponent {
handleWindowFocus = () => { handleWindowFocus = () => {
this.props.dispatch(focusApp()); this.props.dispatch(focusApp());
this.props.dispatch(submitMarkers()); this.props.dispatch(submitMarkers({ immediate: true }));
} }
handleWindowBlur = () => { handleWindowBlur = () => {