Remove status.contentHtml
This commit is contained in:
parent
36e27eb592
commit
9e72bfb3e1
|
@ -31,7 +31,7 @@ const TranslateButton: React.FC<ITranslateButton> = ({ status }) => {
|
||||||
target_languages: targetLanguages,
|
target_languages: targetLanguages,
|
||||||
} = instance.pleroma.metadata.translation;
|
} = instance.pleroma.metadata.translation;
|
||||||
|
|
||||||
const renderTranslate = (me || allowUnauthenticated) && (allowRemote || status.account.local) && ['public', 'unlisted'].includes(status.visibility) && status.contentHtml.length > 0 && status.language !== null && intl.locale !== status.language;
|
const renderTranslate = (me || allowUnauthenticated) && (allowRemote || status.account.local) && ['public', 'unlisted'].includes(status.visibility) && status.content.length > 0 && status.language !== null && intl.locale !== status.language;
|
||||||
|
|
||||||
const supportsLanguages = (!sourceLanguages || sourceLanguages.includes(status.language!)) && (!targetLanguages || targetLanguages.includes(intl.locale));
|
const supportsLanguages = (!sourceLanguages || sourceLanguages.includes(status.language!)) && (!targetLanguages || targetLanguages.includes(intl.locale));
|
||||||
|
|
||||||
|
|
|
@ -49,7 +49,7 @@ const ReplyIndicator: React.FC<IReplyIndicator> = ({ className, status, hideActi
|
||||||
<Markup
|
<Markup
|
||||||
className='break-words'
|
className='break-words'
|
||||||
size='sm'
|
size='sm'
|
||||||
dangerouslySetInnerHTML={{ __html: status.contentHtml }}
|
dangerouslySetInnerHTML={{ __html: status.content }}
|
||||||
direction={getTextDirection(status.search_index)}
|
direction={getTextDirection(status.search_index)}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
|
|
@ -195,7 +195,7 @@ const EventInformation: React.FC<IEventInformation> = ({ params }) => {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Stack className='mt-4 sm:p-2' space={2}>
|
<Stack className='mt-4 sm:p-2' space={2}>
|
||||||
{!!status.contentHtml.trim() && (
|
{!!status.content.trim() && (
|
||||||
<Stack space={1}>
|
<Stack space={1}>
|
||||||
<Text size='xl' weight='bold'>
|
<Text size='xl' weight='bold'>
|
||||||
<FormattedMessage id='event.description' defaultMessage='Description' />
|
<FormattedMessage id='event.description' defaultMessage='Description' />
|
||||||
|
|
|
@ -43,7 +43,7 @@ const CompareHistoryModal: React.FC<ICompareHistoryModal> = ({ onClose, statusId
|
||||||
body = (
|
body = (
|
||||||
<div className='divide-y divide-solid divide-gray-200 dark:divide-gray-800'>
|
<div className='divide-y divide-solid divide-gray-200 dark:divide-gray-800'>
|
||||||
{versions?.map((version) => {
|
{versions?.map((version) => {
|
||||||
const content = { __html: version.contentHtml };
|
const content = { __html: version.content };
|
||||||
const spoilerContent = { __html: version.spoilerHtml };
|
const spoilerContent = { __html: version.spoilerHtml };
|
||||||
|
|
||||||
const poll = typeof version.poll !== 'string' && version.poll;
|
const poll = typeof version.poll !== 'string' && version.poll;
|
||||||
|
|
|
@ -88,7 +88,6 @@ export const StatusRecord = ImmutableRecord({
|
||||||
event: null as ReturnType<typeof EventRecord> | null,
|
event: null as ReturnType<typeof EventRecord> | null,
|
||||||
|
|
||||||
// Internal fields
|
// Internal fields
|
||||||
contentHtml: '',
|
|
||||||
expectsCard: false,
|
expectsCard: false,
|
||||||
hidden: false,
|
hidden: false,
|
||||||
search_index: '',
|
search_index: '',
|
||||||
|
|
|
@ -109,7 +109,6 @@ export const calculateStatus = (
|
||||||
if (oldStatus && oldStatus.content === status.content && oldStatus.spoiler_text === status.spoiler_text) {
|
if (oldStatus && oldStatus.content === status.content && oldStatus.spoiler_text === status.spoiler_text) {
|
||||||
return status.merge({
|
return status.merge({
|
||||||
search_index: oldStatus.search_index,
|
search_index: oldStatus.search_index,
|
||||||
contentHtml: oldStatus.contentHtml,
|
|
||||||
spoilerHtml: oldStatus.spoilerHtml,
|
spoilerHtml: oldStatus.spoilerHtml,
|
||||||
hidden: oldStatus.hidden,
|
hidden: oldStatus.hidden,
|
||||||
});
|
});
|
||||||
|
@ -120,7 +119,7 @@ export const calculateStatus = (
|
||||||
|
|
||||||
return status.merge({
|
return status.merge({
|
||||||
search_index: domParser.parseFromString(searchContent, 'text/html').documentElement.textContent || '',
|
search_index: domParser.parseFromString(searchContent, 'text/html').documentElement.textContent || '',
|
||||||
contentHtml: DOMPurify.sanitize(stripCompatibilityFeatures(emojify(status.content, emojiMap)), { USE_PROFILES: { html: true } }),
|
content: DOMPurify.sanitize(stripCompatibilityFeatures(status.content), { USE_PROFILES: { html: true } }),
|
||||||
spoilerHtml: DOMPurify.sanitize(emojify(escapeTextContentForBrowser(spoilerText), emojiMap), { USE_PROFILES: { html: true } }),
|
spoilerHtml: DOMPurify.sanitize(emojify(escapeTextContentForBrowser(spoilerText), emojiMap), { USE_PROFILES: { html: true } }),
|
||||||
hidden: expandSpoilers ? false : spoilerText.length > 0 || status.sensitive,
|
hidden: expandSpoilers ? false : spoilerText.length > 0 || status.sensitive,
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import escapeTextContentForBrowser from 'escape-html';
|
import escapeTextContentForBrowser from 'escape-html';
|
||||||
|
import DOMPurify from 'isomorphic-dompurify';
|
||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
|
|
||||||
import emojify from 'soapbox/features/emoji/index.ts';
|
import emojify from 'soapbox/features/emoji/index.ts';
|
||||||
|
@ -106,13 +107,13 @@ type Translation = {
|
||||||
const transformStatus = <T extends TransformableStatus>({ pleroma, ...status }: T) => {
|
const transformStatus = <T extends TransformableStatus>({ pleroma, ...status }: T) => {
|
||||||
const emojiMap = makeCustomEmojiMap(status.emojis);
|
const emojiMap = makeCustomEmojiMap(status.emojis);
|
||||||
|
|
||||||
const contentHtml = stripCompatibilityFeatures(emojify(status.content, emojiMap));
|
const content = DOMPurify.sanitize(stripCompatibilityFeatures(status.content), { USE_PROFILES: { html: true } });
|
||||||
const spoilerHtml = emojify(escapeTextContentForBrowser(status.spoiler_text), emojiMap);
|
const spoilerHtml = emojify(escapeTextContentForBrowser(status.spoiler_text), emojiMap);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
...status,
|
...status,
|
||||||
approval_status: 'approval' as const,
|
approval_status: 'approval' as const,
|
||||||
contentHtml,
|
content,
|
||||||
expectsCard: false,
|
expectsCard: false,
|
||||||
event: pleroma?.event,
|
event: pleroma?.event,
|
||||||
filtered: [],
|
filtered: [],
|
||||||
|
|
Loading…
Reference in New Issue