v4: a handle with this instance's own host names the local user — another instance writes bob from here as bob@gerbeur.example, so a mention or a link copied from there named no one here: /@bob@gerbeur.example was a 404, and the mention notified nobody. localHandle (shared/validation.ts) drops this instance's host, its API's or its pages', from a handle; resolveUsername reads names by it, so the page, the API and the Open Graph 301 reach bob at /@bob, and so do the mention notifications and the chat's highlight and chime.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -75,6 +75,22 @@ export function splitHandle(handle: string): { name: string; host?: string } {
|
||||
: { name: handle.slice(0, at), host: handle.slice(at + 1) };
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns `handle` as this instance writes it, `isSelfHost` telling its own
|
||||
* host. Another instance writes a user from here with this one's host,
|
||||
* `bob@gerbeur.example`, who is `bob` here: a mention or a link copied from
|
||||
* there names them so. Any other handle is returned as it is. The server
|
||||
* resolves names by it (`resolveUsername`, the mention notifications), and
|
||||
* the chat's highlight (`mentionsUser`) reads mentions by it.
|
||||
*/
|
||||
export function localHandle(
|
||||
handle: string,
|
||||
isSelfHost: (host: string) => boolean,
|
||||
): string {
|
||||
const { name, host } = splitHandle(handle);
|
||||
return host && isSelfHost(host) ? name : handle;
|
||||
}
|
||||
|
||||
/**
|
||||
* How often a dump's or a playlist's slug may change, counted from the aliases
|
||||
* the changes left: 3 times a day. Moderators are exempt. slug-service refuses
|
||||
|
||||
Reference in New Issue
Block a user