The code powering m.abunchtell.com https://m.abunchtell.com
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。
 
 
 
 

22 行
627 B

  1. import { Map as ImmutableMap } from 'immutable';
  2. import { NOTIFICATIONS_UPDATE } from 'mastodon/actions/notifications';
  3. import { APP_FOCUS, APP_UNFOCUS } from 'mastodon/actions/app';
  4. const initialState = ImmutableMap({
  5. focused: true,
  6. unread: 0,
  7. });
  8. export default function missed_updates(state = initialState, action) {
  9. switch(action.type) {
  10. case APP_FOCUS:
  11. return state.set('focused', true).set('unread', 0);
  12. case APP_UNFOCUS:
  13. return state.set('focused', false);
  14. case NOTIFICATIONS_UPDATE:
  15. return state.get('focused') ? state : state.update('unread', x => x + 1);
  16. default:
  17. return state;
  18. }
  19. };