Skip to content

Commit

Permalink
Fix: getSensitiveFileCountのクエリ修正 (#541)
Browse files Browse the repository at this point in the history
  • Loading branch information
penginn-net authored Dec 3, 2024
1 parent 55999f9 commit 1a19bfb
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions packages/backend/src/core/DriveService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { Inject, Injectable } from '@nestjs/common';
import { ModuleRef } from '@nestjs/core';
import sharp from 'sharp';
import { sharpBmp } from '@misskey-dev/sharp-read-bmp';
import { IsNull } from 'typeorm';
import { In, IsNull } from 'typeorm';
import { DeleteObjectCommandInput, PutObjectCommandInput, NoSuchKey } from '@aws-sdk/client-s3';
import { DI } from '@/di-symbols.js';
import type { DriveFilesRepository, UsersRepository, DriveFoldersRepository, UserProfilesRepository, MiMeta } from '@/models/_.js';
Expand Down Expand Up @@ -973,11 +973,10 @@ export class DriveService {
if (FileIds.length === 0) return 0;
let SensitiveCount = 0;

for (const FileId of FileIds) {
const file = await this.driveFilesRepository.findOneBy({ id: FileId });
if (file?.isSensitive) SensitiveCount++;
const files = await this.driveFilesRepository.findBy({ id: In(FileIds) });
for (const file of files) {
if (file.isSensitive) SensitiveCount++;
}

return SensitiveCount;
}
}

0 comments on commit 1a19bfb

Please sign in to comment.