Skip to content
Snippets Groups Projects
Commit 7fe93702 authored by Acid Chicken (硫酸鶏)'s avatar Acid Chicken (硫酸鶏) Committed by syuilo
Browse files

Update html.ts (#3603)

parent 656cec65
No related branches found
No related tags found
No related merge requests found
......@@ -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;
},
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment