revers
This commit is contained in:
parent
3ccf2ea098
commit
025a8e23c4
|
@ -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, Metas } from '@/models/index.js';
|
import { Notes, Users } 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';
|
||||||
|
@ -66,17 +66,12 @@ export default define(meta, paramDef, async (ps, user) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
// .andWhere('(note.userHost IN (:instances)) OR (note.userHost IS NULL)', { instances: instances })
|
// .andWhere('(note.userHost IN (:instances)) OR (note.userHost IS NULL)', { instances: instances })
|
||||||
|
|
||||||
//#region Construct query
|
//#region Construct query
|
||||||
const instancesQuery = Metas.createQueryBuilder('meta')
|
|
||||||
.select('recommendedInstances');
|
|
||||||
// .where('meta.recommendedInstances = ANY(:instance)', { instance: m.recommendedInstances });
|
|
||||||
|
|
||||||
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 ${ instancesQuery.getQuery() }`);
|
qb.where('note.userHost IN (:instances)', { instances: m.recommendedInstances })
|
||||||
// .orWhere('note.userHost IS NULL');
|
.orWhere('note.userHost IS NULL');
|
||||||
}))
|
}))
|
||||||
.andWhere('(note.visibility = \'public\')')
|
.andWhere('(note.visibility = \'public\')')
|
||||||
.innerJoinAndSelect('note.user', 'user')
|
.innerJoinAndSelect('note.user', 'user')
|
||||||
|
|
|
@ -17,7 +17,7 @@ export default class extends Channel {
|
||||||
|
|
||||||
public async init(params: any) {
|
public async init(params: any) {
|
||||||
const meta = await fetchMeta();
|
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
|
// Subscribe events
|
||||||
this.subscriber.on('notesStream', this.onNote);
|
this.subscriber.on('notesStream', this.onNote);
|
||||||
|
|
|
@ -144,17 +144,20 @@ const headerTabs = $computed(() => [{
|
||||||
title: i18n.ts._timelines.local,
|
title: i18n.ts._timelines.local,
|
||||||
icon: 'fas fa-user-group',
|
icon: 'fas fa-user-group',
|
||||||
iconOnly: true,
|
iconOnly: true,
|
||||||
}, {
|
}] : []),
|
||||||
|
...(isRecommendedTimelineAvailable ? [{
|
||||||
key: 'recommended',
|
key: 'recommended',
|
||||||
title: i18n.ts._timelines.recommended,
|
title: i18n.ts._timelines.recommended,
|
||||||
icon: 'fas fa-signs-post',
|
icon: 'fas fa-user-signs-post',
|
||||||
iconOnly: true,
|
iconOnly: true,
|
||||||
}, {
|
}] : []),
|
||||||
|
...(isLocalTimelineAvailable ? [{
|
||||||
key: 'social',
|
key: 'social',
|
||||||
title: i18n.ts._timelines.social,
|
title: i18n.ts._timelines.social,
|
||||||
icon: 'fas fa-handshake-simple',
|
icon: 'fas fa-user-handshake-simple',
|
||||||
iconOnly: true,
|
iconOnly: true,
|
||||||
}] : []), ...(isGlobalTimelineAvailable ? [{
|
}] : []),
|
||||||
|
...(isGlobalTimelineAvailable ? [{
|
||||||
key: 'global',
|
key: 'global',
|
||||||
title: i18n.ts._timelines.global,
|
title: i18n.ts._timelines.global,
|
||||||
icon: 'fas fa-globe',
|
icon: 'fas fa-globe',
|
||||||
|
|
Loading…
Reference in New Issue