gearheads
/
mastodon
Archived
2
0
Fork 0

Remove unused `missed_update` state (#25832)

gh/dev
Renaud Chaput 2023-07-08 20:02:14 +02:00 committed by GitHub
parent a7ca33ad96
commit 41a505513f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 0 additions and 35 deletions

View File

@ -26,7 +26,6 @@ import lists from './lists';
import markers from './markers'; import markers from './markers';
import media_attachments from './media_attachments'; import media_attachments from './media_attachments';
import meta from './meta'; import meta from './meta';
import { missedUpdatesReducer } from './missed_updates';
import { modalReducer } from './modal'; import { modalReducer } from './modal';
import mutes from './mutes'; import mutes from './mutes';
import notifications from './notifications'; import notifications from './notifications';
@ -82,7 +81,6 @@ const reducers = {
suggestions, suggestions,
polls, polls,
trends, trends,
missed_updates: missedUpdatesReducer,
markers, markers,
picture_in_picture, picture_in_picture,
history, history,

View File

@ -1,33 +0,0 @@
import { Record } from 'immutable';
import type { Action } from 'redux';
import { focusApp, unfocusApp } from '../actions/app';
import { NOTIFICATIONS_UPDATE } from '../actions/notifications';
interface MissedUpdatesState {
focused: boolean;
unread: number;
}
const initialState = Record<MissedUpdatesState>({
focused: true,
unread: 0,
})();
export function missedUpdatesReducer(
state = initialState,
action: Action<string>
) {
switch (action.type) {
case focusApp.type:
return state.set('focused', true).set('unread', 0);
case unfocusApp.type:
return state.set('focused', false);
case NOTIFICATIONS_UPDATE:
return state.get('focused')
? state
: state.update('unread', (x) => x + 1);
default:
return state;
}
}