Browse Source

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

* Fix mark as read in notifications to be saved immediately

* fix code style
master
Takeshi Umeda 3 years ago
committed by GitHub
parent
commit
bec8b12bb5
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 3 deletions
  1. +6
    -2
      app/javascript/mastodon/actions/markers.js
  2. +2
    -0
      app/javascript/mastodon/features/notifications/index.js
  3. +1
    -1
      app/javascript/mastodon/features/ui/index.js

+ 6
- 2
app/javascript/mastodon/actions/markers.js View File

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

+ 2
- 0
app/javascript/mastodon/features/notifications/index.js View File

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

+ 1
- 1
app/javascript/mastodon/features/ui/index.js View File

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

Loading…
Cancel
Save