|
|
|
@ -75,6 +75,7 @@ export function normalizeStatus(status, normalOldStatus, settings) {
|
|
|
|
|
normalStatus.contentHtml = normalOldStatus.get('contentHtml');
|
|
|
|
|
normalStatus.spoilerHtml = normalOldStatus.get('spoilerHtml');
|
|
|
|
|
normalStatus.hidden = normalOldStatus.get('hidden');
|
|
|
|
|
normalStatus.translation = normalOldStatus.get('translation');
|
|
|
|
|
} else {
|
|
|
|
|
const spoilerText = normalStatus.spoiler_text || '';
|
|
|
|
|
const searchContent = ([spoilerText, status.content].concat((status.poll && status.poll.options) ? status.poll.options.map(option => option.title) : [])).concat(status.media_attachments.map(att => att.description)).join('\n\n').replace(/<br\s*\/?>/g, '\n').replace(/<\/p><p>/g, '\n\n');
|
|
|
|
@ -86,6 +87,18 @@ export function normalizeStatus(status, normalOldStatus, settings) {
|
|
|
|
|
normalStatus.hidden = (spoilerText.length > 0 || normalStatus.sensitive) && autoHideCW(settings, spoilerText);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (normalOldStatus) {
|
|
|
|
|
const list = normalOldStatus.get('media_attachments');
|
|
|
|
|
if (normalStatus.media_attachments && list) {
|
|
|
|
|
normalStatus.media_attachments.forEach(item => {
|
|
|
|
|
const oldItem = list.find(i => i.get('id') === item.id);
|
|
|
|
|
if (oldItem && oldItem.get('description') === item.description) {
|
|
|
|
|
item.translation = oldItem.get('translation')
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return normalStatus;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -104,15 +117,23 @@ export function normalizeStatusTranslation(translation, status) {
|
|
|
|
|
return normalTranslation;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function normalizePoll(poll) {
|
|
|
|
|
export function normalizePoll(poll, normalOldPoll) {
|
|
|
|
|
const normalPoll = { ...poll };
|
|
|
|
|
const emojiMap = makeEmojiMap(poll.emojis);
|
|
|
|
|
|
|
|
|
|
normalPoll.options = poll.options.map((option, index) => ({
|
|
|
|
|
normalPoll.options = poll.options.map((option, index) => {
|
|
|
|
|
const normalOption = {
|
|
|
|
|
...option,
|
|
|
|
|
voted: poll.own_votes && poll.own_votes.includes(index),
|
|
|
|
|
titleHtml: emojify(escapeTextContentForBrowser(option.title), emojiMap),
|
|
|
|
|
}));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (normalOldPoll && normalOldPoll.getIn(['options', index, 'title']) === option.title) {
|
|
|
|
|
normalOption.translation = normalOldPoll.getIn(['options', index, 'translation']);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return normalOption
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
return normalPoll;
|
|
|
|
|
}
|
|
|
|
|