Merge branch 'codex/fix/media-load-failure-alert'

# Conflicts:
#	public/translations/ar/default.json
#	public/translations/bn/default.json
#	public/translations/cs/default.json
#	public/translations/da/default.json
#	public/translations/de/default.json
#	public/translations/el/default.json
#	public/translations/en/default.json
#	public/translations/es/default.json
#	public/translations/fa/default.json
#	public/translations/fi/default.json
#	public/translations/fil/default.json
#	public/translations/fr/default.json
#	public/translations/he/default.json
#	public/translations/hi/default.json
#	public/translations/hu/default.json
#	public/translations/id/default.json
#	public/translations/it/default.json
#	public/translations/ja/default.json
#	public/translations/ko/default.json
#	public/translations/mr/default.json
#	public/translations/nl/default.json
#	public/translations/no/default.json
#	public/translations/pl/default.json
#	public/translations/pt/default.json
#	public/translations/ro/default.json
#	public/translations/ru/default.json
#	public/translations/sq/default.json
#	public/translations/sv/default.json
#	public/translations/te/default.json
#	public/translations/th/default.json
#	public/translations/tr/default.json
#	public/translations/uk/default.json
#	public/translations/ur/default.json
#	public/translations/vi/default.json
#	public/translations/zh/default.json
This commit is contained in:
Tommaso Casaburi
2026-05-14 16:38:01 +07:00
42 changed files with 621 additions and 125 deletions
@@ -185,7 +185,7 @@ const renderContent = async (comment: TestComment) => {
});
};
const renderContentWithProps = async (props: { comment: TestComment; prependContent?: React.ReactNode }) => {
const renderContentWithProps = async (props: { appendContent?: React.ReactNode; comment: TestComment; prependContent?: React.ReactNode }) => {
await act(async () => {
root.render(createElement(CommentContent, props as any));
});
@@ -268,6 +268,26 @@ describe('CommentContent', () => {
expect(blockquote?.querySelectorAll('br')).toHaveLength(1);
});
it('renders appended content after markdown with a two-line break separator', async () => {
await renderContentWithProps({
appendContent: createElement('span', { 'data-testid': 'append' }, 'media failed'),
comment: {
cid: 'post-1',
content: 'body',
postCid: 'post-1',
},
});
const blockquote = container.querySelector('blockquote');
const markdown = container.querySelector('[data-testid="markdown"]');
const append = container.querySelector('[data-testid="append"]');
expect(markdown?.textContent).toBe('body');
expect(append?.textContent).toBe('media failed');
expect(blockquote?.lastChild).toBe(append);
expect(blockquote?.querySelectorAll('br')).toHaveLength(2);
});
it('truncates long comments outside the post view and expands them on demand', async () => {
const longComment = 'x'.repeat(1105);
@@ -71,7 +71,7 @@ const getFailedCommentError = (comment: Comment | undefined): unknown => {
return Array.isArray(comment.errors) ? comment.errors.find(Boolean) : undefined;
};
const CommentContent = ({ comment: post, prependContent }: { comment: Comment; prependContent?: ReactNode }) => {
const CommentContent = ({ appendContent, comment: post, prependContent }: { appendContent?: ReactNode; comment: Comment; prependContent?: ReactNode }) => {
const { t } = useTranslation();
const params = useParams();
const location = useLocation();
@@ -308,6 +308,13 @@ const CommentContent = ({ comment: post, prependContent }: { comment: Comment; p
{loadingString}
</>
)}
{appendContent && (
<>
<br />
<br />
{appendContent}
</>
)}
</blockquote>
);
};