fix: make sure outgoing remote mentions get resolved correctly if referenced with non-canonical casing (resolves #646)

This commit is contained in:
Laura Hausmann 2024-10-24 05:43:41 +02:00 committed by kakkokari-gtyih
parent 224bbd486f
commit 92b7453dd9
1 changed files with 1 additions and 1 deletions

View File

@ -406,7 +406,7 @@ export class MfmService {
mention: (node) => {
const a = doc.createElement('a');
const { username, host, acct } = node.props;
const remoteUserInfo = mentionedRemoteUsers.find(remoteUser => remoteUser.username === username && remoteUser.host === host);
const remoteUserInfo = mentionedRemoteUsers.find(remoteUser => remoteUser.username.toLowerCase() === username.toLowerCase() && remoteUser.host?.toLowerCase() === host?.toLowerCase());
a.setAttribute('href', remoteUserInfo ? (remoteUserInfo.url ? remoteUserInfo.url : remoteUserInfo.uri) : `${this.config.url}/${acct}`);
a.className = 'u-url mention';
a.textContent = acct;