fix code quality issues
This commit is contained in:
parent
e4ee9580e3
commit
4a615ff251
|
@ -90,15 +90,11 @@ export class NoteReadService implements OnApplicationShutdown {
|
|||
): Promise<void> {
|
||||
if (notes.length === 0) return;
|
||||
|
||||
const noteIds = new Set<MiNote['id']>();
|
||||
|
||||
for (const note of notes) {
|
||||
if (note.mentions && note.mentions.includes(userId)) {
|
||||
noteIds.add(note.id);
|
||||
} else if (note.visibleUserIds && note.visibleUserIds.includes(userId)) {
|
||||
noteIds.add(note.id);
|
||||
}
|
||||
}
|
||||
const noteIds = new Set<MiNote['id']>(
|
||||
notes.filter(note =>
|
||||
(note.mentions?.includes(userId) ?? false) || (note.visibleUserIds?.includes(userId) ?? false)
|
||||
).map(note => note.id),
|
||||
);
|
||||
|
||||
if (noteIds.size === 0) return;
|
||||
|
||||
|
|
|
@ -28,6 +28,7 @@ import type { UsersRepository, NotesRepository, FollowingsRepository, AbuseUserR
|
|||
import { bindThis } from '@/decorators.js';
|
||||
import type { MiLocalUser, MiRemoteUser } from '@/models/User.js';
|
||||
import { isNotNull } from '@/misc/is-not-null.js';
|
||||
import { GlobalEventService } from '@/core/GlobalEventService.js';
|
||||
import { getApHrefNullable, getApId, getApIds, getApType, isAccept, isActor, isAdd, isAnnounce, isBlock, isCollection, isCollectionOrOrderedCollection, isCreate, isDelete, isFlag, isFollow, isLike, isMove, isPost, isReject, isRemove, isTombstone, isUndo, isUpdate, validActor, validPost } from './type.js';
|
||||
import { ApNoteService } from './models/ApNoteService.js';
|
||||
import { ApLoggerService } from './ApLoggerService.js';
|
||||
|
@ -36,8 +37,6 @@ import { ApResolverService } from './ApResolverService.js';
|
|||
import { ApAudienceService } from './ApAudienceService.js';
|
||||
import { ApPersonService } from './models/ApPersonService.js';
|
||||
import { ApQuestionService } from './models/ApQuestionService.js';
|
||||
import { CacheService } from '@/core/CacheService.js';
|
||||
import { GlobalEventService } from '@/core/GlobalEventService.js';
|
||||
import type { Resolver } from './ApResolverService.js';
|
||||
import type { IAccept, IAdd, IAnnounce, IBlock, ICreate, IDelete, IFlag, IFollow, ILike, IObject, IReject, IRemove, IUndo, IUpdate, IMove } from './type.js';
|
||||
|
||||
|
|
|
@ -77,9 +77,7 @@ export class NoteReactionEntityService implements OnModuleInit {
|
|||
withNote: boolean;
|
||||
},
|
||||
) : Promise<Packed<'NoteReaction'>[]> {
|
||||
const opts = Object.assign({
|
||||
withNote: false,
|
||||
}, options);
|
||||
const opts = { withNote: false, ...options };
|
||||
|
||||
return (await Promise.allSettled(reactions.map(x => this.pack(x, me, opts))))
|
||||
.filter(result => result.status === 'fulfilled')
|
||||
|
|
|
@ -8,7 +8,6 @@ import { Inject, Injectable } from '@nestjs/common';
|
|||
import { Endpoint } from '@/server/api/endpoint-base.js';
|
||||
import type { DriveFilesRepository, GalleryPostsRepository } from '@/models/_.js';
|
||||
import { MiGalleryPost } from '@/models/GalleryPost.js';
|
||||
import type { MiDriveFile } from '@/models/DriveFile.js';
|
||||
import { IdService } from '@/core/IdService.js';
|
||||
import { GalleryPostEntityService } from '@/core/entities/GalleryPostEntityService.js';
|
||||
import { DI } from '@/di-symbols.js';
|
||||
|
|
|
@ -7,7 +7,6 @@ import ms from 'ms';
|
|||
import { Inject, Injectable } from '@nestjs/common';
|
||||
import { Endpoint } from '@/server/api/endpoint-base.js';
|
||||
import type { DriveFilesRepository, GalleryPostsRepository } from '@/models/_.js';
|
||||
import type { MiDriveFile } from '@/models/DriveFile.js';
|
||||
import { GalleryPostEntityService } from '@/core/entities/GalleryPostEntityService.js';
|
||||
import { DI } from '@/di-symbols.js';
|
||||
import { isNotNull } from '@/misc/is-not-null.js';
|
||||
|
|
|
@ -7,7 +7,6 @@ import { IsNull } from 'typeorm';
|
|||
import { Inject, Injectable } from '@nestjs/common';
|
||||
import type { UsersRepository } from '@/models/_.js';
|
||||
import * as Acct from '@/misc/acct.js';
|
||||
import type { MiUser } from '@/models/User.js';
|
||||
import { Endpoint } from '@/server/api/endpoint-base.js';
|
||||
import { MetaService } from '@/core/MetaService.js';
|
||||
import { UserEntityService } from '@/core/entities/UserEntityService.js';
|
||||
|
|
|
@ -97,10 +97,10 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
qb
|
||||
.from(this.noteReactionsRepository.metadata.targetName, 'reaction')
|
||||
.where('"reaction"."userId" = :userId', { userId: ps.userId }),
|
||||
ps.sinceId, ps.untilId, ps.sinceDate, ps.untilDate
|
||||
ps.sinceId, ps.untilId, ps.sinceDate, ps.untilDate,
|
||||
),
|
||||
'reaction',
|
||||
'"reaction"."noteId" = note.id'
|
||||
'"reaction"."noteId" = note.id',
|
||||
);
|
||||
|
||||
this.queryService.generateVisibilityQuery(query, me);
|
||||
|
|
Loading…
Reference in a new issue