mirror of
https://iceshrimp.dev/limepotato/jormungandr-bite.git
synced 2024-11-26 11:57:34 -07:00
t
This commit is contained in:
parent
ea2e088553
commit
de7db2cc3e
1 changed files with 8 additions and 4 deletions
|
@ -1,6 +1,6 @@
|
||||||
import { Brackets } from 'typeorm';
|
import { Brackets } from 'typeorm';
|
||||||
import { fetchMeta } from '@/misc/fetch-meta.js';
|
import { fetchMeta } from '@/misc/fetch-meta.js';
|
||||||
import { Notes, Users } from '@/models/index.js';
|
import { Notes, Metas } from '@/models/index.js';
|
||||||
import { activeUsersChart } from '@/services/chart/index.js';
|
import { activeUsersChart } from '@/services/chart/index.js';
|
||||||
import define from '../../define.js';
|
import define from '../../define.js';
|
||||||
import { ApiError } from '../../error.js';
|
import { ApiError } from '../../error.js';
|
||||||
|
@ -65,13 +65,17 @@ export default define(meta, paramDef, async (ps, user) => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// .andWhere('(note.userHost IN (:instances)) OR (note.userHost IS NULL)', { instances: instances })
|
//#region Construct query
|
||||||
|
const recommendedQuery = Metas.createQueryBuilder('meta')
|
||||||
|
.select('meta.recommendedInstances')
|
||||||
|
.where('meta.recommendedInstances = ANY');
|
||||||
|
|
||||||
//#region Construct query
|
//#region Construct query
|
||||||
const query = makePaginationQuery(Notes.createQueryBuilder('note'),
|
const query = makePaginationQuery(Notes.createQueryBuilder('note'),
|
||||||
ps.sinceId, ps.untilId, ps.sinceDate, ps.untilDate)
|
ps.sinceId, ps.untilId, ps.sinceDate, ps.untilDate)
|
||||||
.andWhere(new Brackets(qb => {
|
.andWhere(new Brackets(qb => {
|
||||||
qb.where('note.userHost IN (:instances)', { instances: m.recommendedInstances })
|
qb.where(`((note.userHost IN (${ recommendedQuery.getQuery() }))`)
|
||||||
.orWhere('note.userHost IS NULL');
|
.orWhere('(note.visibility = \'public\') AND (note.userHost IS NULL)');
|
||||||
}))
|
}))
|
||||||
.andWhere('(note.visibility = \'public\')')
|
.andWhere('(note.visibility = \'public\')')
|
||||||
.innerJoinAndSelect('note.user', 'user')
|
.innerJoinAndSelect('note.user', 'user')
|
||||||
|
|
Loading…
Reference in a new issue