Merge commit 'f877aa9d70
' into kb_migration
This commit is contained in:
commit
32f0e619f0
440 changed files with 6249 additions and 3435 deletions
|
@ -1,5 +1,5 @@
|
|||
import { STORE_HYDRATE } from 'mastodon/actions/store';
|
||||
import { APP_LAYOUT_CHANGE } from 'mastodon/actions/app';
|
||||
import { changeLayout } from 'mastodon/actions/app';
|
||||
import { Map as ImmutableMap } from 'immutable';
|
||||
import { layoutFromWindow } from 'mastodon/is_mobile';
|
||||
|
||||
|
@ -14,8 +14,8 @@ export default function meta(state = initialState, action) {
|
|||
switch(action.type) {
|
||||
case STORE_HYDRATE:
|
||||
return state.merge(action.state.get('meta')).set('permissions', action.state.getIn(['role', 'permissions']));
|
||||
case APP_LAYOUT_CHANGE:
|
||||
return state.set('layout', action.layout);
|
||||
case changeLayout.type:
|
||||
return state.set('layout', action.payload.layout);
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
|
|
|
@ -1,21 +0,0 @@
|
|||
import { Map as ImmutableMap } from 'immutable';
|
||||
import { NOTIFICATIONS_UPDATE } from 'mastodon/actions/notifications';
|
||||
import { APP_FOCUS, APP_UNFOCUS } from 'mastodon/actions/app';
|
||||
|
||||
const initialState = ImmutableMap({
|
||||
focused: true,
|
||||
unread: 0,
|
||||
});
|
||||
|
||||
export default function missed_updates(state = initialState, action) {
|
||||
switch(action.type) {
|
||||
case APP_FOCUS:
|
||||
return state.set('focused', true).set('unread', 0);
|
||||
case APP_UNFOCUS:
|
||||
return state.set('focused', false);
|
||||
case NOTIFICATIONS_UPDATE:
|
||||
return state.get('focused') ? state : state.update('unread', x => x + 1);
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
}
|
31
app/javascript/mastodon/reducers/missed_updates.ts
Normal file
31
app/javascript/mastodon/reducers/missed_updates.ts
Normal file
|
@ -0,0 +1,31 @@
|
|||
import { Record } from 'immutable';
|
||||
import type { Action } from 'redux';
|
||||
import { NOTIFICATIONS_UPDATE } from '../actions/notifications';
|
||||
import { focusApp, unfocusApp } from '../actions/app';
|
||||
|
||||
type MissedUpdatesState = {
|
||||
focused: boolean;
|
||||
unread: number;
|
||||
};
|
||||
const initialState = Record<MissedUpdatesState>({
|
||||
focused: true,
|
||||
unread: 0,
|
||||
})();
|
||||
|
||||
export default function missed_updates(
|
||||
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;
|
||||
}
|
||||
}
|
|
@ -23,8 +23,8 @@ import {
|
|||
MARKERS_FETCH_SUCCESS,
|
||||
} from '../actions/markers';
|
||||
import {
|
||||
APP_FOCUS,
|
||||
APP_UNFOCUS,
|
||||
focusApp,
|
||||
unfocusApp,
|
||||
} from '../actions/app';
|
||||
import { DOMAIN_BLOCK_SUCCESS } from 'mastodon/actions/domain_blocks';
|
||||
import { TIMELINE_DELETE, TIMELINE_DISCONNECT } from '../actions/timelines';
|
||||
|
@ -259,9 +259,9 @@ export default function notifications(state = initialState, action) {
|
|||
return updateMounted(state);
|
||||
case NOTIFICATIONS_UNMOUNT:
|
||||
return state.update('mounted', count => count - 1);
|
||||
case APP_FOCUS:
|
||||
case focusApp.type:
|
||||
return updateVisibility(state, true);
|
||||
case APP_UNFOCUS:
|
||||
case unfocusApp.type:
|
||||
return updateVisibility(state, false);
|
||||
case NOTIFICATIONS_LOAD_PENDING:
|
||||
return state.update('items', list => state.get('pendingItems').concat(list.take(40))).set('pendingItems', ImmutableList()).set('unread', 0);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue