mirror of
https://github.com/mastodon/mastodon.git
synced 2024-12-15 07:34:58 +01:00
[Glitch] Do not overwrite some status attributes in reducer
Backport 386365090c
This commit is contained in:
parent
64d8d0464d
commit
b383c0688a
@ -62,6 +62,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 \/>/g, '\n').replace(/<\/p><p>/g, '\n\n');
|
const searchContent = [status.spoiler_text, status.content].join('\n\n').replace(/<br \/>/g, '\n').replace(/<\/p><p>/g, '\n\n');
|
||||||
|
|
||||||
const emojiMap = normalStatus.emojis.reduce((obj, emoji) => {
|
const emojiMap = normalStatus.emojis.reduce((obj, emoji) => {
|
||||||
@ -72,6 +75,7 @@ const normalizeStatus = (state, status) => {
|
|||||||
normalStatus.search_index = domParser.parseFromString(searchContent, 'text/html').documentElement.textContent;
|
normalStatus.search_index = domParser.parseFromString(searchContent, 'text/html').documentElement.textContent;
|
||||||
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);
|
||||||
|
}
|
||||||
|
|
||||||
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
Block a user