From f20e5f7899fc69a9fb5ddc0e6e2d1e72d3a71b8f Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Fri, 17 Apr 2020 16:24:36 -0500 Subject: [PATCH] Pull expandSpoilers from Redux store --- app/gabsocial/actions/importer/index.js | 5 ++++- app/gabsocial/actions/importer/normalizer.js | 5 +++-- app/gabsocial/initial_state.js | 1 - 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/app/gabsocial/actions/importer/index.js b/app/gabsocial/actions/importer/index.js index bf0e6d358..1c82d93b0 100644 --- a/app/gabsocial/actions/importer/index.js +++ b/app/gabsocial/actions/importer/index.js @@ -64,7 +64,10 @@ export function importFetchedStatuses(statuses) { const polls = []; function processStatus(status) { - pushUnique(normalStatuses, normalizeStatus(status, getState().getIn(['statuses', status.id]))); + const normalOldStatus = getState().getIn(['statuses', status.id]); + const readingPrefs = getState().getIn(['preferences', 'reading']); + + pushUnique(normalStatuses, normalizeStatus(status, normalOldStatus, readingPrefs)); pushUnique(accounts, status.account); if (status.reblog && status.reblog.id) { diff --git a/app/gabsocial/actions/importer/normalizer.js b/app/gabsocial/actions/importer/normalizer.js index 5badb0c49..f1f4d7a2f 100644 --- a/app/gabsocial/actions/importer/normalizer.js +++ b/app/gabsocial/actions/importer/normalizer.js @@ -1,7 +1,6 @@ import escapeTextContentForBrowser from 'escape-html'; import emojify from '../../features/emoji/emoji'; import { unescapeHTML } from '../../utils/html'; -import { expandSpoilers } from '../../initial_state'; const domParser = new DOMParser(); @@ -35,8 +34,10 @@ export function normalizeAccount(account) { return account; } -export function normalizeStatus(status, normalOldStatus) { +export function normalizeStatus(status, normalOldStatus, readingPrefs) { const normalStatus = { ...status }; + const expandSpoilers = readingPrefs.getIn(['expand', 'spoilers']); + normalStatus.account = status.account.id; if (status.reblog && status.reblog.id) { diff --git a/app/gabsocial/initial_state.js b/app/gabsocial/initial_state.js index 1b6f0bb5f..e991df8fc 100644 --- a/app/gabsocial/initial_state.js +++ b/app/gabsocial/initial_state.js @@ -8,7 +8,6 @@ const getMeta = (prop) => initialState && initialState.meta && initialState.meta export const reduceMotion = getMeta('reduce_motion'); export const autoPlayGif = getMeta('auto_play_gif'); export const displayMedia = getMeta('display_media'); -export const expandSpoilers = getMeta('expand_spoilers'); export const unfollowModal = getMeta('unfollow_modal'); export const boostModal = getMeta('boost_modal'); export const deleteModal = getMeta('delete_modal');