diff --git a/core/html.py b/core/html.py index 8ac3d7d..be5fa97 100644 --- a/core/html.py +++ b/core/html.py @@ -169,7 +169,7 @@ class FediverseHtmlParser(HTMLParser): if looks_like_link: content = content.split("://", 1)[1] if (looks_like_link and len(content) > 30) or has_ellipsis: - return f'{html.escape(content[:30])}' + return f'{html.escape(content[:30])}' else: return f'{html.escape(content)}' diff --git a/static/css/style.css b/static/css/style.css index 1ca8c42..09c4889 100644 --- a/static/css/style.css +++ b/static/css/style.css @@ -394,7 +394,7 @@ img.emoji { vertical-align: baseline; } -.ellipsis::after { +span.ellipsis::after { content: "…"; } @@ -1485,6 +1485,10 @@ form .post { margin: 12px 0 4px 0; } +.post .content p a .invisible { + display: none; +} + .post .attachments { padding-top: 4px; display: grid; diff --git a/tests/api/test_statuses.py b/tests/api/test_statuses.py index 3b763df..50d5ec3 100644 --- a/tests/api/test_statuses.py +++ b/tests/api/test_statuses.py @@ -155,3 +155,23 @@ def test_question_format(api_client, remote_identity): ], "emojis": [], } + + +@pytest.mark.django_db +def test_content_link(api_client, identity, remote_identity): + """ + Ensures mentions work, and only have one link around them. + """ + # Make a local post and check it + response = api_client.post( + "/api/v1/statuses", + data={ + "status": "Takahē - return to the wild - https://www.youtube.com/watch?v=IG423K3pmQI", + }, + ).json() + + # temp fix + assert ( + response["content"] + == '

Takahē - return to the wild - www.youtube.com/watch?v=IG423K

' + )