Browse Source

Submit timeline markers closer to the moment they change

closed-social-glitch-2
Thibaut Girka 4 years ago
committed by ThibG
parent
commit
a681980307
2 changed files with 6 additions and 1 deletions
  1. +2
    -0
      app/javascript/flavours/glitch/features/notifications/index.js
  2. +4
    -1
      app/javascript/flavours/glitch/features/ui/index.js

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

@ -15,6 +15,7 @@ import {
markNotificationsAsRead, markNotificationsAsRead,
} from 'flavours/glitch/actions/notifications'; } from 'flavours/glitch/actions/notifications';
import { addColumn, removeColumn, moveColumn } from 'flavours/glitch/actions/columns'; import { addColumn, removeColumn, moveColumn } from 'flavours/glitch/actions/columns';
import { submitMarkers } from 'flavours/glitch/actions/markers';
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';
import ColumnSettingsContainer from './containers/column_settings_container'; import ColumnSettingsContainer from './containers/column_settings_container';
@ -70,6 +71,7 @@ const mapDispatchToProps = dispatch => ({
}, },
onMarkAsRead() { onMarkAsRead() {
dispatch(markNotificationsAsRead()); dispatch(markNotificationsAsRead());
dispatch(submitMarkers());
}, },
onMount() { onMount() {
dispatch(mountNotifications()); dispatch(mountNotifications());

+ 4
- 1
app/javascript/flavours/glitch/features/ui/index.js View File

@ -12,7 +12,7 @@ import { expandHomeTimeline } from 'flavours/glitch/actions/timelines';
import { expandNotifications, notificationsSetVisibility } from 'flavours/glitch/actions/notifications'; import { expandNotifications, notificationsSetVisibility } from 'flavours/glitch/actions/notifications';
import { fetchFilters } from 'flavours/glitch/actions/filters'; import { fetchFilters } from 'flavours/glitch/actions/filters';
import { clearHeight } from 'flavours/glitch/actions/height_cache'; import { clearHeight } from 'flavours/glitch/actions/height_cache';
import { synchronouslySubmitMarkers, fetchMarkers } from 'flavours/glitch/actions/markers';
import { synchronouslySubmitMarkers, submitMarkers, fetchMarkers } from 'flavours/glitch/actions/markers';
import { WrappedSwitch, WrappedRoute } from 'flavours/glitch/util/react_router_helpers'; import { WrappedSwitch, WrappedRoute } from 'flavours/glitch/util/react_router_helpers';
import UploadArea from './components/upload_area'; import UploadArea from './components/upload_area';
import PermaLink from 'flavours/glitch/components/permalink'; import PermaLink from 'flavours/glitch/components/permalink';
@ -358,6 +358,9 @@ class UI extends React.Component {
handleVisibilityChange = () => { handleVisibilityChange = () => {
const visibility = !document[this.visibilityHiddenProp]; const visibility = !document[this.visibilityHiddenProp];
this.props.dispatch(notificationsSetVisibility(visibility)); this.props.dispatch(notificationsSetVisibility(visibility));
if (visibility) {
this.props.dispatch(submitMarkers());
}
} }
componentWillMount () { componentWillMount () {

Loading…
Cancel
Save