Obliterate initial-state nonsense

stable/1.0.x
Alex Gleason 2020-04-17 18:25:36 -05:00
rodzic ddfd7ccf98
commit 10b6a19e0a
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 7211D1F99744FBB7
4 zmienionych plików z 25 dodań i 18 usunięć

Wyświetl plik

@ -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;

Wyświetl plik

@ -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')) {

Wyświetl plik

@ -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