From ad8d916775899c55f23ea19f6aa42b9342f95f3c Mon Sep 17 00:00:00 2001 From: dakkar Date: Fri, 31 May 2024 11:36:47 +0100 Subject: [PATCH] minimal fixes, thanks tests --- packages/backend/src/core/DriveService.ts | 4 ++-- .../backend/src/server/api/endpoints/channels/timeline.ts | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/backend/src/core/DriveService.ts b/packages/backend/src/core/DriveService.ts index 4203b03c74..dc84ea1999 100644 --- a/packages/backend/src/core/DriveService.ts +++ b/packages/backend/src/core/DriveService.ts @@ -632,8 +632,8 @@ export class DriveService { @bindThis public async updateFile(file: MiDriveFile, values: Partial, updater: MiUser) { - const profile = await this.userProfilesRepository.findOneBy({ userId: file.userId }); - const alwaysMarkNsfw = (await this.roleService.getUserPolicies(file.userId)).alwaysMarkNsfw || (profile !== null && profile!.alwaysMarkNsfw); + const profile = file.userId ? await this.userProfilesRepository.findOneBy({ userId: file.userId }) : null; + const alwaysMarkNsfw = file.userId ? (await this.roleService.getUserPolicies(file.userId)).alwaysMarkNsfw || (profile !== null && profile!.alwaysMarkNsfw) : false; if (values.name != null && !this.driveFileEntityService.validateFileName(values.name)) { throw new DriveService.InvalidFileNameError(); diff --git a/packages/backend/src/server/api/endpoints/channels/timeline.ts b/packages/backend/src/server/api/endpoints/channels/timeline.ts index 295fc5686c..9369481649 100644 --- a/packages/backend/src/server/api/endpoints/channels/timeline.ts +++ b/packages/backend/src/server/api/endpoints/channels/timeline.ts @@ -16,6 +16,7 @@ import { MetaService } from '@/core/MetaService.js'; import { FanoutTimelineEndpointService } from '@/core/FanoutTimelineEndpointService.js'; import { MiLocalUser } from '@/models/User.js'; import { ApiError } from '../../error.js'; +import { Brackets } from 'typeorm'; export const meta = { tags: ['notes', 'channels'],