Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

aescling
Copy link
Contributor

@aescling aescling commented Apr 8, 2022

@[email protected]@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/.@[email protected]\" target=\"_blank\" rel=\"nofollow noopener noreferrer\"><span class=\"invisible\">https://</span><span class=\"ellipsis\">example.org/.@[email protected]</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": "@[email protected], ink on paper",
        "verified_at": null
      }
    ]
  },
  "media_attachments": [],
  "mentions": [
    {
      "id": "106910029666214247",
      "username": "kindle",
      "url": "https://plural.cafe/@kindle",
      "acct": "[email protected]"
    }
  ],
  "tags": [],
  "emojis": [],
  "card": null,
  "poll": null
}

It is very longstanding behavior for `MENTION_RE` to match strings of
the form `@user@domain@thoasuhsantoshu`. This change requires Unicode
whitespace after a message, with an edge case of allowing a mention to
occur at the very end of the post.

This is really a just a start when it comes to mention matching. The
new test is as well. As well as the entire service spec.
@marrus-sh marrus-sh marked this pull request as draft April 9, 2022 02:51
@aescling aescling added STATUS: bug Improper behaviour STATUS: enhancement New feature or improvements to existing STATUS: breaking Resolving this will introduce breaking changes LV.1: Application Backend @ installing and running the application STATUS: discuss This issue should be discussed before further actions are taken labels Apr 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
LV.1: Application Backend @ installing and running the application STATUS: breaking Resolving this will introduce breaking changes STATUS: bug Improper behaviour STATUS: discuss This issue should be discussed before further actions are taken STATUS: enhancement New feature or improvements to existing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant