mastodon icon indicating copy to clipboard operation
mastodon copied to clipboard

Add API parameter to safeguard unexpect mentions in new posts

Open ClearlyClaire opened this issue 3 years ago • 5 comments

Add optional safeguard_mentions parameter to POST /api/v1/statuses.

When this parameters is set (to a possibly empty list of account IDs) and processing the status text leads to mentions to accounts not listed in safeguard_mentions, the server does not save the status and instead returns an error with an extra_accounts attribute listing the mentioned accounts that caused the error.

The goal of this API parameter is to allow clients to warn users of unexpected mentions: a somewhat common error for newcomers is to accidentally send a DM to a person they did not expect. “Unexpected mentions” is left to the appreciation of the client, but a possible possible interpretation would be “any mention that is not at the beginning of the post”.

This API was designed to ensure that a warning feature would not not trigger for unresolvable mention-like strings, nor let unexpected mentions slip because of client bugs or temporary network issues. Indeed, the client may not have resolved all mentioned accounts, especially if those were copy-pasted or not known to the server yet. Doing this purely client-side would involve the client sending multiple lookup requests and only sending the post after they all returned, and could still let a temporary failure or race condition slip, although this is very unlikely. Involving the server makes sense as it does look up the mentioned accounts at posting time and is authoritative on who would be mentioned.

ClearlyClaire avatar May 07 '22 13:05 ClearlyClaire

ping @Gargron

ClearlyClaire avatar Jul 28 '22 11:07 ClearlyClaire

@Gargron do you mind reviewing this?

ClearlyClaire avatar Aug 28 '22 09:08 ClearlyClaire

@Gargron Would it be possible to have your opinion on this?

tchoutri avatar Nov 08 '22 16:11 tchoutri

This pull request has merge conflicts that must be resolved before it can be merged.

github-actions[bot] avatar Dec 15 '22 17:12 github-actions[bot]

Looks like the only build failure here is the Prettier issue that was already fixed

nightpool avatar Dec 16 '22 21:12 nightpool