This commit is contained in:
ThatOneCalculator 2022-07-29 15:07:07 -07:00
parent 3ccf2ea098
commit 025a8e23c4
3 changed files with 12 additions and 14 deletions

View file

@ -1,6 +1,6 @@
import { Brackets } from 'typeorm';
import { fetchMeta } from '@/misc/fetch-meta.js';
import { Notes, Metas } from '@/models/index.js';
import { Notes, Users } from '@/models/index.js';
import { activeUsersChart } from '@/services/chart/index.js';
import define from '../../define.js';
import { ApiError } from '../../error.js';
@ -66,17 +66,12 @@ export default define(meta, paramDef, async (ps, user) => {
}
// .andWhere('(note.userHost IN (:instances)) OR (note.userHost IS NULL)', { instances: instances })
//#region Construct query
const instancesQuery = Metas.createQueryBuilder('meta')
.select('recommendedInstances');
// .where('meta.recommendedInstances = ANY(:instance)', { instance: m.recommendedInstances });
const query = makePaginationQuery(Notes.createQueryBuilder('note'),
ps.sinceId, ps.untilId, ps.sinceDate, ps.untilDate)
.andWhere(new Brackets(qb => {
qb.where(`note.userHost IN ${ instancesQuery.getQuery() }`);
// .orWhere('note.userHost IS NULL');
qb.where('note.userHost IN (:instances)', { instances: m.recommendedInstances })
.orWhere('note.userHost IS NULL');
}))
.andWhere('(note.visibility = \'public\')')
.innerJoinAndSelect('note.user', 'user')

View file

@ -17,7 +17,7 @@ export default class extends Channel {
public async init(params: any) {
const meta = await fetchMeta();
if (meta.disableLocalTimeline && !this.user!.isAdmin && !this.user!.isModerator) return;
if (meta.disableRecommendedTimeline && !this.user!.isAdmin && !this.user!.isModerator) return;
// Subscribe events
this.subscriber.on('notesStream', this.onNote);

View file

@ -144,17 +144,20 @@ const headerTabs = $computed(() => [{
title: i18n.ts._timelines.local,
icon: 'fas fa-user-group',
iconOnly: true,
}, {
}] : []),
...(isRecommendedTimelineAvailable ? [{
key: 'recommended',
title: i18n.ts._timelines.recommended,
icon: 'fas fa-signs-post',
icon: 'fas fa-user-signs-post',
iconOnly: true,
}, {
}] : []),
...(isLocalTimelineAvailable ? [{
key: 'social',
title: i18n.ts._timelines.social,
icon: 'fas fa-handshake-simple',
icon: 'fas fa-user-handshake-simple',
iconOnly: true,
}] : []), ...(isGlobalTimelineAvailable ? [{
}] : []),
...(isGlobalTimelineAvailable ? [{
key: 'global',
title: i18n.ts._timelines.global,
icon: 'fas fa-globe',