mirror of
https://iceshrimp.dev/crimekillz/iceshrimp-161sh.git
synced 2024-11-23 12:39:59 +01:00
Update html.ts (#3603)
This commit is contained in:
parent
6d115fd142
commit
3fd16b3896
@ -103,8 +103,18 @@ export default (tokens: Node[], mentionedRemoteUsers: INote['mentionedRemoteUser
|
|||||||
mention(token) {
|
mention(token) {
|
||||||
const a = doc.createElement('a');
|
const a = doc.createElement('a');
|
||||||
const { username, host, acct } = token.props;
|
const { username, host, acct } = token.props;
|
||||||
|
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);
|
const remoteUserInfo = mentionedRemoteUsers.find(remoteUser => remoteUser.username === username && remoteUser.host === host);
|
||||||
a.href = remoteUserInfo ? remoteUserInfo.uri : `${config.url}/${acct}`;
|
a.href = remoteUserInfo ? remoteUserInfo.uri : `${config.url}/${acct}`;
|
||||||
|
break;
|
||||||
|
}
|
||||||
a.textContent = acct;
|
a.textContent = acct;
|
||||||
return a;
|
return a;
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user