diff --git a/packages/backend/src/server/api/endpoints/notes/recommended-timeline.ts b/packages/backend/src/server/api/endpoints/notes/recommended-timeline.ts index 8c4c670618..e89f8db3f1 100644 --- a/packages/backend/src/server/api/endpoints/notes/recommended-timeline.ts +++ b/packages/backend/src/server/api/endpoints/notes/recommended-timeline.ts @@ -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') diff --git a/packages/backend/src/server/api/stream/channels/recommended-timeline.ts b/packages/backend/src/server/api/stream/channels/recommended-timeline.ts index f64af21047..4d4b324f9a 100644 --- a/packages/backend/src/server/api/stream/channels/recommended-timeline.ts +++ b/packages/backend/src/server/api/stream/channels/recommended-timeline.ts @@ -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); diff --git a/packages/client/src/pages/timeline.vue b/packages/client/src/pages/timeline.vue index c00a1b1e88..b01f473000 100644 --- a/packages/client/src/pages/timeline.vue +++ b/packages/client/src/pages/timeline.vue @@ -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',