Clean up
This commit is contained in:
parent
e7fa99de86
commit
8d9596d209
|
@ -59,18 +59,16 @@ export const paramDef = {
|
||||||
// eslint-disable-next-line import/no-default-export
|
// eslint-disable-next-line import/no-default-export
|
||||||
export default define(meta, paramDef, async (ps, user) => {
|
export default define(meta, paramDef, async (ps, user) => {
|
||||||
const m = await fetchMeta();
|
const m = await fetchMeta();
|
||||||
// const formattedInstances = `(${m.recommendedInstances.toString().split(',').map(v => JSON.stringify(`'${v.toString()}'`)).join(', ')})`;
|
|
||||||
if (m.disableRecommendedTimeline) {
|
if (m.disableRecommendedTimeline) {
|
||||||
if (user == null || (!user.isAdmin && !user.isModerator)) {
|
if (user == null || (!user.isAdmin && !user.isModerator)) {
|
||||||
throw new ApiError(meta.errors.rtlDisabled);
|
throw new ApiError(meta.errors.rtlDisabled);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const cursed = `(note.userHost = ANY ('{"${m.recommendedInstances.join('","')}"}'))`;
|
|
||||||
//#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(cursed)
|
.andWhere(`(note.userHost = ANY ('{"${m.recommendedInstances.join('","')}"}'))`)
|
||||||
.andWhere('(note.visibility = \'public\')')
|
.andWhere('(note.visibility = \'public\')')
|
||||||
.innerJoinAndSelect('note.user', 'user')
|
.innerJoinAndSelect('note.user', 'user')
|
||||||
.leftJoinAndSelect('user.avatar', 'avatar')
|
.leftJoinAndSelect('user.avatar', 'avatar')
|
||||||
|
|
Loading…
Reference in New Issue