Use status ID instead of passing status objects (#39727)

This commit is contained in:
Echo authored and GitHub committed 2026-07-06 13:00:27 +00:00
1 parent dff66fe890
commit ea07161698
16 files changed
+145 -157

No files matched your search

@@ -1,24 +1,17 @@
import type { List } from 'immutable';
import type { CustomEmoji } from '../models/custom_emoji';
import type { Status } from '../models/status';
import { useStatus } from '../hooks/useStatus';
import { EmojiHTML } from './emoji/html';
import { StatusBanner, BannerVariant } from './status_banner';
export const ContentWarning: React.FC<{
status: Status;
statusId: string;
expanded?: boolean;
onClick?: () => void;
}> = ({ status, expanded, onClick }) => {
const hasSpoiler = !!status.get('spoiler_text');
if (!hasSpoiler) {
return null;
}
const text =
status.getIn(['translation', 'spoilerHtml']) || status.get('spoilerHtml');
if (typeof text !== 'string' || text.length === 0) {
}> = ({ statusId, expanded, onClick }) => {
const status = useStatus(statusId);
const hasSpoiler = !!status?.spoiler_text;
const text = status?.translation?.spoilerHtml ?? status?.spoilerHtml;
if (!hasSpoiler || !text) {
return null;
}
@@ -28,11 +21,7 @@ export const ContentWarning: React.FC<{
onClick={onClick}
variant={BannerVariant.Warning}
>
<EmojiHTML
as='span'
htmlString={text}
extraEmojis={status.get('emojis') as List<CustomEmoji>}
/>
<EmojiHTML as='span' htmlString={text} extraEmojis={status.emojis} />
</StatusBanner>
);
};