mirror of
https://github.com/glitch-soc/mastodon.git
synced 2024-11-23 16:44:04 -05:00
[Glitch] Fix some remote posts getting truncated
Port 4d59dfb1c6
to glitch-soc
Signed-off-by: Claire <claire.github-309c@sitedethib.com>
This commit is contained in:
parent
6a8623588a
commit
cd3a636b7f
@ -45,6 +45,21 @@ describe('computeHashtagBarForStatus', () => {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('does not truncate the contents when the last child is a text node', () => {
|
||||||
|
const status = createStatus(
|
||||||
|
'this is a #<a class="zrl" href="https://example.com/search?tag=test">test</a>. Some more text',
|
||||||
|
['test'],
|
||||||
|
);
|
||||||
|
|
||||||
|
const { hashtagsInBar, statusContentProps } =
|
||||||
|
computeHashtagBarForStatus(status);
|
||||||
|
|
||||||
|
expect(hashtagsInBar).toEqual([]);
|
||||||
|
expect(statusContentProps.statusContent).toMatchInlineSnapshot(
|
||||||
|
`"this is a #<a class="zrl" href="https://example.com/search?tag=test">test</a>. Some more text"`,
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
it('extract tags from the last line', () => {
|
it('extract tags from the last line', () => {
|
||||||
const status = createStatus(
|
const status = createStatus(
|
||||||
'<p>Simple text</p><p><a href="test">#hashtag</a></p>',
|
'<p>Simple text</p><p><a href="test">#hashtag</a></p>',
|
||||||
|
@ -109,7 +109,7 @@ export function computeHashtagBarForStatus(status: StatusLike): {
|
|||||||
|
|
||||||
const lastChild = template.content.lastChild;
|
const lastChild = template.content.lastChild;
|
||||||
|
|
||||||
if (!lastChild) return defaultResult;
|
if (!lastChild || lastChild.nodeType === Node.TEXT_NODE) return defaultResult;
|
||||||
|
|
||||||
template.content.removeChild(lastChild);
|
template.content.removeChild(lastChild);
|
||||||
const contentWithoutLastLine = template;
|
const contentWithoutLastLine = template;
|
||||||
|
Loading…
Reference in New Issue
Block a user