glitch-soc / mastodon

A glitchy but lovable microblogging server
https://glitch-soc.github.io/docs/
GNU Affero General Public License v3.0
701 stars 181 forks source link

Vaild mentions are sometimes not hyperlinked #1735

Open single-right-quote opened 2 years ago

single-right-quote commented 2 years ago

Steps to reproduce the problem

  1. Post a mention of the form @user@domain@extra-text-here (the class of mentions that trigger this problem may be larger); per MENTION_RE this is a valid mention.

Expected behaviour

The status have a mention, and the content should hyperlink to @user@domain

Actual behaviour

The status has a mention but the content does not have any hyperlinks.

Specifications

This is probably also an issue with upstream but I have not confirmed this yet.

Here is an example status demonstrating the issue.

Here is a permalink to a post without a content warning; no hyperlink is visible at all. However, the mention is definitely there, as evidenced by the following screenshot where I reply to that post:

Replying to the aforementioned post reveals that it has a `mention`

Here is a JSON blob of that post as grabbed from developer tools, with a nonempty mentions and hyperlink-less content, as expected.

{
  "id": "108088805528385836",
  "created_at": "2022-04-07T04:04:43.576Z",
  "in_reply_to_id": null,
  "in_reply_to_account_id": null,
  "sensitive": false,
  "spoiler_text": "",
  "visibility": "unlisted",
  "language": "en",
  "uri": "https://glitch.cat.family/users/aescling/statuses/108088805528385836",
  "url": "https://glitch.cat.family/@aescling/108088805528385836",
  "replies_count": 0,
  "reblogs_count": 0,
  "favourites_count": 0,
  "edited_at": null,
  "favourited": false,
  "reblogged": false,
  "muted": false,
  "bookmarked": false,
  "pinned": false,
  "local_only": false,
  "content": "<p>@kindle@plural.cafe@asntohuetoautaosuh</p>",
  "reblog": null,
  "application": {
    "name": "Web",
    "website": null
  },
  "account": {
    "id": "106886632504935780",
    "username": "aescling",
    "acct": "aescling",
    "display_name": "sword syscatmin woman",
    "locked": true,
    "bot": false,
    "discoverable": true,
    "group": false,
    "created_at": "2021-09-06T00:00:00.000Z",
    "note": "<p>black cat made entirely of fire, they/she/it/æ; co-admin(s) what manage the technical infrastructure. it’s pronounced “ashling”; “æsc” and “cat” also work</p><p>follow requests open!<br />@ us about</p><p>* technical issues regarding the instance;<br />* smash ultimate,<br />* weird small software,<br />* dragons<br />* pupys of any kind, and, of course,<br />* cats ;3</p><p>as we have a job and other hobbies, please understand that we cannot always address a technical issue right away.</p><p>reachable via email and matrix, with the same account details as here; DM if you need contact details for another protocol</p>",
    "url": "https://glitch.cat.family/@aescling",
    "avatar": "https://media.glitch.cat.family/accounts/avatars/106/886/632/504/935/780/original/d58c5cca4b0b1da3.jpg",
    "avatar_static": "https://media.glitch.cat.family/accounts/avatars/106/886/632/504/935/780/original/d58c5cca4b0b1da3.jpg",
    "header": "https://glitch.cat.family/headers/original/missing.png",
    "header_static": "https://glitch.cat.family/headers/original/missing.png",
    "followers_count": 31,
    "following_count": 54,
    "statuses_count": 8759,
    "last_status_at": "2022-04-07",
    "emojis": [],
    "fields": [
      {
        "name": "website",
        "value": "<a href=\"https://æscling.cat.family\" target=\"_blank\" rel=\"nofollow noopener noreferrer me\"><span class=\"invisible\">https://</span><span class=\"\">æscling.cat.family</span><span class=\"invisible\"></span></a>",
        "verified_at": null
      },
      {
        "name": "neopronouns",
        "value": "æ / ær / æi / æin / æinselves",
        "verified_at": null
      },
      {
        "name": "avatar",
        "value": "@saltmalkin@twitter.com, ink on paper",
        "verified_at": null
      }
    ]
  },
  "media_attachments": [],
  "mentions": [
    {
      "id": "106910029666214247",
      "username": "kindle",
      "url": "https://plural.cafe/@kindle",
      "acct": "kindle@plural.cafe"
    }
  ],
  "tags": [],
  "emojis": [],
  "card": null,
  "poll": null
}

I am using Firefox 99.0 on Windows 11; my instance is on https://github.com/kibicat/mastodon/commit/d0f03db93d83122cfaee46b0e12cff51b6b11702, which merges in https://github.com/glitch-soc/mastodon/commit/363773d0e9ffa9f4efc564603327f225193a2bf1.

ClearlyClaire commented 2 years ago

This is probably also an issue with upstream but I have not confirmed this yet.

This is indeed an upstream issue. I'd say @a@foo@bar should not be considered a valid mention, to be honest.

single-right-quote commented 2 years ago

I very much agree, but MENTION_RE has matched mentions like that for as far back as I could be bothered to check (over six years ago); if that were to be changed, that would be its own issue upstream I think.