render HTML mentions correctly
Reviewed-on: FoundKeyGang/FoundKey#145 Changelog: Fixed
This commit is contained in:
commit
515957ee74
1 changed files with 4 additions and 4 deletions
|
@ -108,13 +108,13 @@ export async function toHtml(mfmText: string, mentions?: string[]): Promise<stri
|
||||||
if (ids.length > 0) {
|
if (ids.length > 0) {
|
||||||
const mentionedUsers = await UserProfiles.createQueryBuilder('user_profile')
|
const mentionedUsers = await UserProfiles.createQueryBuilder('user_profile')
|
||||||
.leftJoin('user_profile.user', 'user')
|
.leftJoin('user_profile.user', 'user')
|
||||||
.select('user.username')
|
.select('user.username', 'username')
|
||||||
.addSelect('user.host')
|
.addSelect('user.host', 'host')
|
||||||
// links should preferably use user friendly urls, only fall back to AP ids
|
// links should preferably use user friendly urls, only fall back to AP ids
|
||||||
.addSelect('COALESCE(user_profile.url, user.uri)', 'url')
|
.addSelect('COALESCE(user_profile.url, user.uri)', 'url')
|
||||||
.where('"userId" IN (:...ids)', { ids })
|
.where('"userId" IN (:...ids)', { ids })
|
||||||
.getMany();
|
.getRawMany();
|
||||||
const userInfo = mentionedUsers.find(user => user.user?.username === username && user.userHost === host);
|
const userInfo = mentionedUsers.find(user => user.username === username && user.host === host);
|
||||||
if (userInfo != null) {
|
if (userInfo != null) {
|
||||||
// Mastodon microformat: span.h-card > a.u-url.mention
|
// Mastodon microformat: span.h-card > a.u-url.mention
|
||||||
const a = doc.createElement('a');
|
const a = doc.createElement('a');
|
||||||
|
|
Loading…
Reference in a new issue