You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

middleware.web.js 1000B

123456789101112131415161718192021222324252627282930
  1. import { MiddlewareRegistry } from '../base/redux';
  2. import { getHideSelfView, SETTINGS_UPDATED } from '../base/settings';
  3. import { NOTIFICATION_TIMEOUT_TYPE, showNotification } from '../notifications';
  4. import { openSettingsDialog } from './actions';
  5. import { SETTINGS_TABS } from './constants';
  6. MiddlewareRegistry.register(({ dispatch, getState }) => next => action => {
  7. const oldValue = getHideSelfView(getState());
  8. const result = next(action);
  9. switch (action.type) {
  10. case SETTINGS_UPDATED: {
  11. const newValue = action.settings.disableSelfView;
  12. if (newValue !== oldValue && newValue) {
  13. dispatch(showNotification({
  14. titleKey: 'notify.selfViewTitle',
  15. customActionNameKey: [ 'settings.title' ],
  16. customActionHandler: [ () =>
  17. dispatch(openSettingsDialog(SETTINGS_TABS.MORE))
  18. ]
  19. }, NOTIFICATION_TIMEOUT_TYPE.STICKY));
  20. }
  21. }
  22. }
  23. return result;
  24. });