mirror of
https://activitypub.software/TransFem-org/Sharkey
synced 2024-11-26 16:03:02 +00:00
Update html.ts (#3603)
This commit is contained in:
parent
656cec65b9
commit
7fe937026b
1 changed files with 12 additions and 2 deletions
|
@ -103,8 +103,18 @@ export default (tokens: Node[], mentionedRemoteUsers: INote['mentionedRemoteUser
|
|||
mention(token) {
|
||||
const a = doc.createElement('a');
|
||||
const { username, host, acct } = token.props;
|
||||
const remoteUserInfo = mentionedRemoteUsers.find(remoteUser => remoteUser.username === username && remoteUser.host === host);
|
||||
a.href = remoteUserInfo ? remoteUserInfo.uri : `${config.url}/${acct}`;
|
||||
switch (host) {
|
||||
case 'github.com':
|
||||
a.href = `https://github.com/${username}`;
|
||||
break;
|
||||
case 'twitter.com':
|
||||
a.href = `https://twitter.com/${username}`;
|
||||
break;
|
||||
default:
|
||||
const remoteUserInfo = mentionedRemoteUsers.find(remoteUser => remoteUser.username === username && remoteUser.host === host);
|
||||
a.href = remoteUserInfo ? remoteUserInfo.uri : `${config.url}/${acct}`;
|
||||
break;
|
||||
}
|
||||
a.textContent = acct;
|
||||
return a;
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue