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

environments/review-empty-p-95p8d6/deployments/2689
Alex Gleason 2023-02-21 09:00:16 -06:00
rodzic 6413bed23f
commit dc8952ad18
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 7211D1F99744FBB7
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);
}),
);
};