forked from treehouse/mastodon
parent
d9500c8a3b
commit
386365090c
|
@ -56,6 +56,9 @@ const normalizeStatus = (state, status) => {
|
||||||
normalStatus.reblog = status.reblog.id;
|
normalStatus.reblog = status.reblog.id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Only calculate these values when status first encountered
|
||||||
|
// Otherwise keep the ones already in the reducer
|
||||||
|
if (!state.has(status.id)) {
|
||||||
const searchContent = [status.spoiler_text, status.content].join('\n\n').replace(/<br\s*\/?>/g, '\n').replace(/<\/p><p>/g, '\n\n');
|
const searchContent = [status.spoiler_text, status.content].join('\n\n').replace(/<br\s*\/?>/g, '\n').replace(/<\/p><p>/g, '\n\n');
|
||||||
|
|
||||||
const emojiMap = normalStatus.emojis.reduce((obj, emoji) => {
|
const emojiMap = normalStatus.emojis.reduce((obj, emoji) => {
|
||||||
|
@ -67,6 +70,7 @@ const normalizeStatus = (state, status) => {
|
||||||
normalStatus.contentHtml = emojify(normalStatus.content, emojiMap);
|
normalStatus.contentHtml = emojify(normalStatus.content, emojiMap);
|
||||||
normalStatus.spoilerHtml = emojify(escapeTextContentForBrowser(normalStatus.spoiler_text || ''), emojiMap);
|
normalStatus.spoilerHtml = emojify(escapeTextContentForBrowser(normalStatus.spoiler_text || ''), emojiMap);
|
||||||
normalStatus.hidden = normalStatus.sensitive;
|
normalStatus.hidden = normalStatus.sensitive;
|
||||||
|
}
|
||||||
|
|
||||||
return state.update(status.id, ImmutableMap(), map => map.mergeDeep(fromJS(normalStatus)));
|
return state.update(status.id, ImmutableMap(), map => map.mergeDeep(fromJS(normalStatus)));
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue