summaryrefslogtreecommitdiff
path: root/packages/backend/src/core/MfmService.ts
diff options
context:
space:
mode:
authorかっこかり <67428053+kakkokari-gtyih@users.noreply.github.com>2024-11-09 10:58:09 +0900
committerGitHub <noreply@github.com>2024-11-09 10:58:09 +0900
commit4a62051ce7bd369335cf020d0bd39019f2a45212 (patch)
treede8ea29003a51c281a34b64631cba7e20b491119 /packages/backend/src/core/MfmService.ts
parentrefactor(frontend): 動画UIのフルスクリーン周りの調整 (#14877) (diff)
downloadsharkey-4a62051ce7bd369335cf020d0bd39019f2a45212.tar.gz
sharkey-4a62051ce7bd369335cf020d0bd39019f2a45212.tar.bz2
sharkey-4a62051ce7bd369335cf020d0bd39019f2a45212.zip
fix(backend): ローカルユーザーへのメンションを含むノートが連合される際に正しいURLに変換されないことがある問題を修正 (#14879)
* fix: make sure mentions of local users get rendered correctly during AP delivery (resolves #645) * Update Changelog * indent --------- Co-authored-by: Laura Hausmann <laura@hausmann.dev> Co-authored-by: syuilo <4439005+syuilo@users.noreply.github.com>
Diffstat (limited to 'packages/backend/src/core/MfmService.ts')
-rw-r--r--packages/backend/src/core/MfmService.ts4
1 files changed, 3 insertions, 1 deletions
diff --git a/packages/backend/src/core/MfmService.ts b/packages/backend/src/core/MfmService.ts
index edfb3aa4fc..8061622340 100644
--- a/packages/backend/src/core/MfmService.ts
+++ b/packages/backend/src/core/MfmService.ts
@@ -407,7 +407,9 @@ export class MfmService {
const a = doc.createElement('a');
const { username, host, acct } = node.props;
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.setAttribute('href', remoteUserInfo
+ ? (remoteUserInfo.url ? remoteUserInfo.url : remoteUserInfo.uri)
+ : `${this.config.url}/${acct.endsWith(`@${this.config.url}`) ? acct.substring(0, acct.length - this.config.url.length - 1) : acct}`);
a.className = 'u-url mention';
a.textContent = acct;
return a;