backend: fix mentionedUsers and userInfo queries
Some checks failed
ci/woodpecker/push/build Pipeline was successful
ci/woodpecker/push/lint-backend Pipeline was successful
ci/woodpecker/push/lint-client Pipeline was successful
ci/woodpecker/push/lint-foundkey-js Pipeline was successful
ci/woodpecker/push/test Pipeline was successful
ci/woodpecker/pr/lint-foundkey-js Pipeline was successful
ci/woodpecker/pr/lint-backend Pipeline was successful
ci/woodpecker/pr/build Pipeline was successful
ci/woodpecker/pr/lint-client Pipeline failed
ci/woodpecker/pr/test Pipeline failed
Some checks failed
ci/woodpecker/push/build Pipeline was successful
ci/woodpecker/push/lint-backend Pipeline was successful
ci/woodpecker/push/lint-client Pipeline was successful
ci/woodpecker/push/lint-foundkey-js Pipeline was successful
ci/woodpecker/push/test Pipeline was successful
ci/woodpecker/pr/lint-foundkey-js Pipeline was successful
ci/woodpecker/pr/lint-backend Pipeline was successful
ci/woodpecker/pr/build Pipeline was successful
ci/woodpecker/pr/lint-client Pipeline failed
ci/woodpecker/pr/test Pipeline failed
Turns out `getMany` doesn't work with the specific query used, so use `getRawMany` instead. Also fixup the predicate used in userInfo to use the correct field names.
This commit is contained in:
parent
c926b4fbcc
commit
a2fad7ce61
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) {
|
||||
const mentionedUsers = await UserProfiles.createQueryBuilder('user_profile')
|
||||
.leftJoin('user_profile.user', 'user')
|
||||
.select('user.username')
|
||||
.addSelect('user.host')
|
||||
.select('user.username', 'username')
|
||||
.addSelect('user.host', 'host')
|
||||
// links should preferably use user friendly urls, only fall back to AP ids
|
||||
.addSelect('COALESCE(user_profile.url, user.uri)', 'url')
|
||||
.where('"userId" IN (:...ids)', { ids })
|
||||
.getMany();
|
||||
const userInfo = mentionedUsers.find(user => user.user?.username === username && user.userHost === host);
|
||||
.getRawMany();
|
||||
const userInfo = mentionedUsers.find(user => user.username === username && user.host === host);
|
||||
if (userInfo != null) {
|
||||
// Mastodon microformat: span.h-card > a.u-url.mention
|
||||
const a = doc.createElement('a');
|
||||
|
|
Loading…
Reference in a new issue