test(backend): e2e/timelines.ts: 非FTT時のテストを追加, 凍結のテストを追加, これにかかる幾つかのバグ修正 (#16284)
* test(backend): 非FTT時のテストを追加 * clean up * skip test about reply * Fix #16289 * clean up * cherry pick * add renote test * Fix https://github.com/misskey-dev/misskey/issues/16293 * remove debug log
This commit is contained in:
parent
927aa9dc3d
commit
8c65d8d020
|
@ -20,6 +20,8 @@ import { CacheService } from '@/core/CacheService.js';
|
||||||
import { isReply } from '@/misc/is-reply.js';
|
import { isReply } from '@/misc/is-reply.js';
|
||||||
import { isInstanceMuted } from '@/misc/is-instance-muted.js';
|
import { isInstanceMuted } from '@/misc/is-instance-muted.js';
|
||||||
|
|
||||||
|
type NoteFilter = (note: MiNote) => boolean;
|
||||||
|
|
||||||
type TimelineOptions = {
|
type TimelineOptions = {
|
||||||
untilId: string | null,
|
untilId: string | null,
|
||||||
sinceId: string | null,
|
sinceId: string | null,
|
||||||
|
@ -28,7 +30,7 @@ type TimelineOptions = {
|
||||||
me?: { id: MiUser['id'] } | undefined | null,
|
me?: { id: MiUser['id'] } | undefined | null,
|
||||||
useDbFallback: boolean,
|
useDbFallback: boolean,
|
||||||
redisTimelines: FanoutTimelineName[],
|
redisTimelines: FanoutTimelineName[],
|
||||||
noteFilter?: (note: MiNote) => boolean,
|
noteFilter?: NoteFilter,
|
||||||
alwaysIncludeMyNotes?: boolean;
|
alwaysIncludeMyNotes?: boolean;
|
||||||
ignoreAuthorFromBlock?: boolean;
|
ignoreAuthorFromBlock?: boolean;
|
||||||
ignoreAuthorFromMute?: boolean;
|
ignoreAuthorFromMute?: boolean;
|
||||||
|
@ -79,7 +81,7 @@ export class FanoutTimelineEndpointService {
|
||||||
const shouldFallbackToDb = noteIds.length === 0 || ps.sinceId != null && ps.sinceId < oldestNoteId;
|
const shouldFallbackToDb = noteIds.length === 0 || ps.sinceId != null && ps.sinceId < oldestNoteId;
|
||||||
|
|
||||||
if (!shouldFallbackToDb) {
|
if (!shouldFallbackToDb) {
|
||||||
let filter = ps.noteFilter ?? (_note => true);
|
let filter = ps.noteFilter ?? (_note => true) as NoteFilter;
|
||||||
|
|
||||||
if (ps.alwaysIncludeMyNotes && ps.me) {
|
if (ps.alwaysIncludeMyNotes && ps.me) {
|
||||||
const me = ps.me;
|
const me = ps.me;
|
||||||
|
@ -145,15 +147,11 @@ export class FanoutTimelineEndpointService {
|
||||||
{
|
{
|
||||||
const parentFilter = filter;
|
const parentFilter = filter;
|
||||||
filter = (note) => {
|
filter = (note) => {
|
||||||
const noteJoined = note as MiNote & {
|
|
||||||
renoteUser: MiUser | null;
|
|
||||||
replyUser: MiUser | null;
|
|
||||||
};
|
|
||||||
if (!ps.ignoreAuthorFromUserSuspension) {
|
if (!ps.ignoreAuthorFromUserSuspension) {
|
||||||
if (note.user!.isSuspended) return false;
|
if (note.user!.isSuspended) return false;
|
||||||
}
|
}
|
||||||
if (note.userId !== note.renoteUserId && noteJoined.renoteUser?.isSuspended) return false;
|
if (note.userId !== note.renoteUserId && note.renote?.user?.isSuspended) return false;
|
||||||
if (note.userId !== note.replyUserId && noteJoined.replyUser?.isSuspended) return false;
|
if (note.userId !== note.replyUserId && note.reply?.user?.isSuspended) return false;
|
||||||
|
|
||||||
return parentFilter(note);
|
return parentFilter(note);
|
||||||
};
|
};
|
||||||
|
@ -200,7 +198,7 @@ export class FanoutTimelineEndpointService {
|
||||||
return await ps.dbFallback(ps.untilId, ps.sinceId, ps.limit);
|
return await ps.dbFallback(ps.untilId, ps.sinceId, ps.limit);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async getAndFilterFromDb(noteIds: string[], noteFilter: (note: MiNote) => boolean, idCompare: (a: string, b: string) => number): Promise<MiNote[]> {
|
private async getAndFilterFromDb(noteIds: string[], noteFilter: NoteFilter, idCompare: (a: string, b: string) => number): Promise<MiNote[]> {
|
||||||
const query = this.notesRepository.createQueryBuilder('note')
|
const query = this.notesRepository.createQueryBuilder('note')
|
||||||
.where('note.id IN (:...noteIds)', { noteIds: noteIds })
|
.where('note.id IN (:...noteIds)', { noteIds: noteIds })
|
||||||
.innerJoinAndSelect('note.user', 'user')
|
.innerJoinAndSelect('note.user', 'user')
|
||||||
|
|
|
@ -237,7 +237,13 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ps.withRenotes === false) {
|
if (ps.withRenotes === false) {
|
||||||
query.andWhere('note.renoteId IS NULL');
|
query.andWhere(new Brackets(qb => {
|
||||||
|
qb.orWhere('note.renoteId IS NULL');
|
||||||
|
qb.orWhere(new Brackets(qb => {
|
||||||
|
qb.orWhere('note.text IS NOT NULL');
|
||||||
|
qb.orWhere('note.fileIds != \'{}\'');
|
||||||
|
}));
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
//#endregion
|
//#endregion
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue