Merge tag 'v3.4.0' into hometown-dev
This commit is contained in:
25
app/javascript/mastodon/reducers/boosts.js
Normal file
25
app/javascript/mastodon/reducers/boosts.js
Normal file
@ -0,0 +1,25 @@
|
||||
import Immutable from 'immutable';
|
||||
|
||||
import {
|
||||
BOOSTS_INIT_MODAL,
|
||||
BOOSTS_CHANGE_PRIVACY,
|
||||
} from 'mastodon/actions/boosts';
|
||||
|
||||
const initialState = Immutable.Map({
|
||||
new: Immutable.Map({
|
||||
privacy: 'public',
|
||||
}),
|
||||
});
|
||||
|
||||
export default function mutes(state = initialState, action) {
|
||||
switch (action.type) {
|
||||
case BOOSTS_INIT_MODAL:
|
||||
return state.withMutations((state) => {
|
||||
state.setIn(['new', 'privacy'], action.privacy);
|
||||
});
|
||||
case BOOSTS_CHANGE_PRIVACY:
|
||||
return state.setIn(['new', 'privacy'], action.privacy);
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
}
|
||||
@ -16,6 +16,7 @@ import push_notifications from './push_notifications';
|
||||
import status_lists from './status_lists';
|
||||
import mutes from './mutes';
|
||||
import blocks from './blocks';
|
||||
import boosts from './boosts';
|
||||
import reports from './reports';
|
||||
import contexts from './contexts';
|
||||
import compose from './compose';
|
||||
@ -57,6 +58,7 @@ const reducers = {
|
||||
push_notifications,
|
||||
mutes,
|
||||
blocks,
|
||||
boosts,
|
||||
reports,
|
||||
contexts,
|
||||
compose,
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
import { MODAL_OPEN, MODAL_CLOSE } from '../actions/modal';
|
||||
import { TIMELINE_DELETE } from '../actions/timelines';
|
||||
|
||||
const initialState = {
|
||||
modalType: null,
|
||||
@ -11,6 +12,8 @@ export default function modal(state = initialState, action) {
|
||||
return { modalType: action.modalType, modalProps: action.modalProps };
|
||||
case MODAL_CLOSE:
|
||||
return (action.modalType === undefined || action.modalType === state.modalType) ? initialState : state;
|
||||
case TIMELINE_DELETE:
|
||||
return (state.modalProps.statusId === action.id) ? initialState : state;
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
|
||||
@ -45,6 +45,7 @@ const initialState = ImmutableMap({
|
||||
}),
|
||||
|
||||
dismissPermissionBanner: false,
|
||||
showUnread: true,
|
||||
|
||||
shows: ImmutableMap({
|
||||
follow: true,
|
||||
|
||||
@ -19,18 +19,18 @@ export default function suggestionsReducer(state = initialState, action) {
|
||||
return state.set('isLoading', true);
|
||||
case SUGGESTIONS_FETCH_SUCCESS:
|
||||
return state.withMutations(map => {
|
||||
map.set('items', fromJS(action.accounts.map(x => x.id)));
|
||||
map.set('items', fromJS(action.suggestions.map(x => ({ ...x, account: x.account.id }))));
|
||||
map.set('isLoading', false);
|
||||
});
|
||||
case SUGGESTIONS_FETCH_FAIL:
|
||||
return state.set('isLoading', false);
|
||||
case SUGGESTIONS_DISMISS:
|
||||
return state.update('items', list => list.filterNot(id => id === action.id));
|
||||
return state.update('items', list => list.filterNot(x => x.account === action.id));
|
||||
case ACCOUNT_BLOCK_SUCCESS:
|
||||
case ACCOUNT_MUTE_SUCCESS:
|
||||
return state.update('items', list => list.filterNot(id => id === action.relationship.id));
|
||||
return state.update('items', list => list.filterNot(x => x.account === action.relationship.id));
|
||||
case DOMAIN_BLOCK_SUCCESS:
|
||||
return state.update('items', list => list.filterNot(id => action.accounts.includes(id)));
|
||||
return state.update('items', list => list.filterNot(x => action.accounts.includes(x.account)));
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
|
||||
@ -9,6 +9,7 @@ import {
|
||||
TIMELINE_CONNECT,
|
||||
TIMELINE_DISCONNECT,
|
||||
TIMELINE_LOAD_PENDING,
|
||||
TIMELINE_MARK_AS_PARTIAL,
|
||||
} from '../actions/timelines';
|
||||
import {
|
||||
ACCOUNT_BLOCK_SUCCESS,
|
||||
@ -168,6 +169,12 @@ export default function timelines(state = initialState, action) {
|
||||
initialTimeline,
|
||||
map => map.set('online', false).update(action.usePendingItems ? 'pendingItems' : 'items', items => items.first() ? items.unshift(null) : items),
|
||||
);
|
||||
case TIMELINE_MARK_AS_PARTIAL:
|
||||
return state.update(
|
||||
action.timeline,
|
||||
initialTimeline,
|
||||
map => map.set('isPartial', true).set('items', ImmutableList()).set('pendingItems', ImmutableList()).set('unread', 0),
|
||||
);
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user