bug fix
This commit is contained in:
parent
8358ace249
commit
140dfdaccc
|
@ -94,7 +94,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||||
] = me ? await Promise.all([
|
] = me ? await Promise.all([
|
||||||
this.cacheService.userMutingsCache.fetch(me.id),
|
this.cacheService.userMutingsCache.fetch(me.id),
|
||||||
]) : [new Set<string>()];
|
]) : [new Set<string>()];
|
||||||
|
console.log(userIdsWhoMeMuting)
|
||||||
let noteIds = await this.redisTimelineService.get(`channelTimeline:${channel.id}`, untilId, sinceId);
|
let noteIds = await this.redisTimelineService.get(`channelTimeline:${channel.id}`, untilId, sinceId);
|
||||||
noteIds = noteIds.slice(0, ps.limit);
|
noteIds = noteIds.slice(0, ps.limit);
|
||||||
|
|
||||||
|
@ -111,9 +111,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||||
let timeline = await query.getMany();
|
let timeline = await query.getMany();
|
||||||
|
|
||||||
timeline = timeline.filter(note => {
|
timeline = timeline.filter(note => {
|
||||||
if (me && isUserRelated(note, userIdsWhoMeMuting, true)) return false;
|
return !isUserRelated(note, userIdsWhoMeMuting);
|
||||||
|
|
||||||
return true;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// TODO: フィルタで件数が減った場合の埋め合わせ処理
|
// TODO: フィルタで件数が減った場合の埋め合わせ処理
|
||||||
|
|
|
@ -9,6 +9,9 @@ import { Endpoint } from '@/server/api/endpoint-base.js';
|
||||||
import { NoteEntityService } from '@/core/entities/NoteEntityService.js';
|
import { NoteEntityService } from '@/core/entities/NoteEntityService.js';
|
||||||
import { DI } from '@/di-symbols.js';
|
import { DI } from '@/di-symbols.js';
|
||||||
import { FeaturedService } from '@/core/FeaturedService.js';
|
import { FeaturedService } from '@/core/FeaturedService.js';
|
||||||
|
import {isUserRelated} from "@/misc/is-user-related.js";
|
||||||
|
import {CacheService} from "@/core/CacheService.js";
|
||||||
|
|
||||||
|
|
||||||
export const meta = {
|
export const meta = {
|
||||||
tags: ['notes'],
|
tags: ['notes'],
|
||||||
|
@ -47,6 +50,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||||
@Inject(DI.notesRepository)
|
@Inject(DI.notesRepository)
|
||||||
private notesRepository: NotesRepository,
|
private notesRepository: NotesRepository,
|
||||||
|
|
||||||
|
private cacheService: CacheService,
|
||||||
private noteEntityService: NoteEntityService,
|
private noteEntityService: NoteEntityService,
|
||||||
private featuredService: FeaturedService,
|
private featuredService: FeaturedService,
|
||||||
) {
|
) {
|
||||||
|
@ -63,6 +67,11 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||||
this.globalNotesRankingCacheLastFetchedAt = Date.now();
|
this.globalNotesRankingCacheLastFetchedAt = Date.now();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
const [
|
||||||
|
userIdsWhoMeMuting,
|
||||||
|
] = me ? await Promise.all([
|
||||||
|
this.cacheService.userMutingsCache.fetch(me.id),
|
||||||
|
]) : [new Set<string>()];
|
||||||
|
|
||||||
if (noteIds.length === 0) {
|
if (noteIds.length === 0) {
|
||||||
return [];
|
return [];
|
||||||
|
@ -83,9 +92,11 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||||
.leftJoinAndSelect('renote.user', 'renoteUser')
|
.leftJoinAndSelect('renote.user', 'renoteUser')
|
||||||
.leftJoinAndSelect('note.channel', 'channel');
|
.leftJoinAndSelect('note.channel', 'channel');
|
||||||
|
|
||||||
const notes = await query.getMany();
|
let notes = await query.getMany();
|
||||||
notes.sort((a, b) => a.id > b.id ? -1 : 1);
|
notes.sort((a, b) => a.id > b.id ? -1 : 1);
|
||||||
|
notes = notes.filter(note => {
|
||||||
|
return !isUserRelated(note, userIdsWhoMeMuting);
|
||||||
|
});
|
||||||
// TODO: ミュート等考慮
|
// TODO: ミュート等考慮
|
||||||
|
|
||||||
return await this.noteEntityService.packMany(notes, me);
|
return await this.noteEntityService.packMany(notes, me);
|
||||||
|
|
Loading…
Reference in New Issue