kopia lustrzana https://gitlab.com/soapbox-pub/soapbox
Replace `<p></p>` with empty string in chats and statuses
rodzic
6413bed23f
commit
dc8952ad18
|
@ -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);
|
||||
}),
|
||||
);
|
||||
};
|
||||
|
|
|
@ -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);
|
||||
}),
|
||||
);
|
||||
};
|
||||
|
|
Ładowanie…
Reference in New Issue