Merge branch 'empty-p' into 'develop'

Replace `<p></p>` with empty string in chats and statuses

See merge request soapbox-pub/soapbox!2306
develop^2
Alex Gleason 2023-02-21 16:38:14 +00:00
commit 02cf175e1f
2 zmienionych plików z 20 dodań i 0 usunięć

Wyświetl plik

@ -50,11 +50,21 @@ const normalizeChatMessageEmojiReaction = (chatMessage: ImmutableMap<string, any
}
};
/** Rewrite `<p></p>` to empty string. */
const fixContent = (chatMessage: ImmutableMap<string, any>) => {
if (chatMessage.get('content') === '<p></p>') {
return chatMessage.set('content', '');
} else {
return chatMessage;
}
};
export const normalizeChatMessage = (chatMessage: Record<string, any>) => {
return ChatMessageRecord(
ImmutableMap(fromJS(chatMessage)).withMutations(chatMessage => {
normalizeMedia(chatMessage);
normalizeChatMessageEmojiReaction(chatMessage);
fixContent(chatMessage);
}),
);
};

Wyświetl plik

@ -205,6 +205,15 @@ const normalizeEvent = (status: ImmutableMap<string, any>) => {
}
};
/** Rewrite `<p></p>` to empty string. */
const fixContent = (status: ImmutableMap<string, any>) => {
if (status.get('content') === '<p></p>') {
return status.set('content', '');
} else {
return status;
}
};
export const normalizeStatus = (status: Record<string, any>) => {
return StatusRecord(
ImmutableMap(fromJS(status)).withMutations(status => {
@ -219,6 +228,7 @@ export const normalizeStatus = (status: Record<string, any>) => {
fixFiltered(status);
fixSensitivity(status);
normalizeEvent(status);
fixContent(status);
}),
);
};