sforkowany z mirror/soapbox
Obliterate initial-state nonsense
rodzic
ddfd7ccf98
commit
10b6a19e0a
|
@ -1,19 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
const element = document.getElementById('initial-state');
|
||||
const initialState = element && JSON.parse(element.textContent);
|
||||
|
||||
const getMeta = (prop) => initialState && initialState.meta && initialState.meta[prop];
|
||||
|
||||
export const reduceMotion = getMeta('reduce_motion');
|
||||
export const displayMedia = getMeta('display_media');
|
||||
export const unfollowModal = getMeta('unfollow_modal');
|
||||
export const boostModal = getMeta('boost_modal');
|
||||
export const deleteModal = getMeta('delete_modal');
|
||||
export const searchEnabled = getMeta('search_enabled');
|
||||
export const invitesEnabled = getMeta('invites_enabled');
|
||||
export const profile_directory = getMeta('profile_directory');
|
||||
export const isStaff = getMeta('is_staff');
|
||||
export const unreadCount = getMeta('unread_count');
|
||||
const initialState = element ? JSON.parse(element.textContent) : {};
|
||||
|
||||
export default initialState;
|
||||
|
|
|
@ -174,7 +174,7 @@ const privacyPreference = (a, b) => {
|
|||
return order[Math.max(order.indexOf(a), order.indexOf(b), 0)];
|
||||
};
|
||||
|
||||
const hydrate = (state, hydratedState) => {
|
||||
const hydrate = (state, hydratedState = ImmutableMap()) => {
|
||||
state = clearAll(state.merge(hydratedState));
|
||||
|
||||
if (hydratedState.has('text')) {
|
||||
|
|
|
@ -1,8 +1,29 @@
|
|||
import { STORE_HYDRATE } from '../actions/store';
|
||||
import { Map as ImmutableMap } from 'immutable';
|
||||
import {
|
||||
Map as ImmutableMap,
|
||||
List as ImmutableList,
|
||||
} from 'immutable';
|
||||
|
||||
const initialState = ImmutableMap({
|
||||
accept_content_types: [],
|
||||
// FIXME: Leave this empty and pull from backend
|
||||
accept_content_types: ImmutableList([
|
||||
'.jpg',
|
||||
'.jpeg',
|
||||
'.png',
|
||||
'.gif',
|
||||
'.webp',
|
||||
'.webm',
|
||||
'.mp4',
|
||||
'.m4v',
|
||||
'.mov',
|
||||
'image/jpeg',
|
||||
'image/png',
|
||||
'image/gif',
|
||||
'image/webp',
|
||||
'video/webm',
|
||||
'video/mp4',
|
||||
'video/quicktime',
|
||||
]),
|
||||
});
|
||||
|
||||
export default function meta(state = initialState, action) {
|
||||
|
|
File diff suppressed because one or more lines are too long
Ładowanie…
Reference in New Issue