kibicat / mastodon

A Mastodon‐compatible fediverse instance (the one used by https://glitch.cat.family).
GNU Affero General Public License v3.0
3 stars 0 forks source link

[NOMERGE] [UNTESTED] Require a word boundary after a mention #39

Open single-right-quote opened 2 years ago

single-right-quote commented 2 years ago

@alpha@example.org@ateohhoaush being processed as a mention bugs me. The testing needs to be way more thorough, but it’s a start. Reallly it ought to be the start of more careful determintation of what can count as a mentiion.

THIS HAS NOT BEEN TESTED. GlitchCat is not even running this code yet.

Some thoughts for later

An idea that is not necessarily trivial: allow i think @alpha/@beta would be well suited to this. This is tricky because https://twitter.com/@beta should never be processed as a mention, which is probably why MENTION_RE forbids an immediately preceding /. However:

image image

Which is absolutely a bug. Here is the JSON of that status:

{
  "id": "108095281606656993",
  "created_at": "2022-04-08T07:31:40.686Z",
  "in_reply_to_id": "108095166497359093",
  "in_reply_to_account_id": "106886632504935780",
  "sensitive": true,
  "spoiler_text": "test posts",
  "visibility": "unlisted",
  "language": "en",
  "uri": "https://glitch.cat.family/users/aescling/statuses/108095281606656993",
  "url": "https://glitch.cat.family/@aescling/108095281606656993",
  "replies_count": 1,
  "reblogs_count": 1,
  "favourites_count": 0,
  "edited_at": null,
  "favourited": false,
  "reblogged": true,
  "muted": false,
  "bookmarked": false,
  "pinned": false,
  "local_only": false,
  "content": "<p><a href=\"https://example.org/.@kindle@plural.cafe\" target=\"_blank\" rel=\"nofollow noopener noreferrer\"><span class=\"invisible\">https://</span><span class=\"ellipsis\">example.org/.@kindle@plural.ca</span><span class=\"invisible\">fe</span></a></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": 32,
    "following_count": 54,
    "statuses_count": 8901,
    "last_status_at": "2022-04-08",
    "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
}