Skip to content

Commit 4a62051

Browse files
kakkokari-gtyihzotanmewsyuilo
authored
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 <[email protected]> Co-authored-by: syuilo <[email protected]>
1 parent 3a42183 commit 4a62051

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@
3737
(Cherry-picked from https://activitypub.software/TransFem-org/Sharkey/-/merge_requests/706)
3838
- Fix: 連合への配信時に、acctの大小文字が区別されてしまい正しくメンションが処理されないことがある問題を修正
3939
(Cherry-picked from https://activitypub.software/TransFem-org/Sharkey/-/merge_requests/711)
40+
- Fix: ローカルユーザーへのメンションを含むノートが連合される際に正しいURLに変換されないことがある問題を修正
41+
(Cherry-picked from https://activitypub.software/TransFem-org/Sharkey/-/merge_requests/712)
4042
- Fix: FTT無効時にユーザーリストタイムラインが使用できない問題を修正
4143
(Cherry-picked from https://activitypub.software/TransFem-org/Sharkey/-/merge_requests/709)
4244
- Enhance: リモートユーザーの照会をオリジナルにリダイレクトするように

packages/backend/src/core/MfmService.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,9 @@ export class MfmService {
407407
const a = doc.createElement('a');
408408
const { username, host, acct } = node.props;
409409
const remoteUserInfo = mentionedRemoteUsers.find(remoteUser => remoteUser.username.toLowerCase() === username.toLowerCase() && remoteUser.host?.toLowerCase() === host?.toLowerCase());
410-
a.setAttribute('href', remoteUserInfo ? (remoteUserInfo.url ? remoteUserInfo.url : remoteUserInfo.uri) : `${this.config.url}/${acct}`);
410+
a.setAttribute('href', remoteUserInfo
411+
? (remoteUserInfo.url ? remoteUserInfo.url : remoteUserInfo.uri)
412+
: `${this.config.url}/${acct.endsWith(`@${this.config.url}`) ? acct.substring(0, acct.length - this.config.url.length - 1) : acct}`);
411413
a.className = 'u-url mention';
412414
a.textContent = acct;
413415
return a;

0 commit comments

Comments
 (0)