From e46e7f5252582d395f2b8f9db115dabfa26a92a5 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sat, 14 Jan 2023 18:04:56 +0900 Subject: ノートをピン留めできる数を設定可能に MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Resolve #9555 --- packages/backend/src/core/NotePiningService.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'packages/backend/src/core/NotePiningService.ts') diff --git a/packages/backend/src/core/NotePiningService.ts b/packages/backend/src/core/NotePiningService.ts index f8997574a7..bc038e17a7 100644 --- a/packages/backend/src/core/NotePiningService.ts +++ b/packages/backend/src/core/NotePiningService.ts @@ -12,6 +12,7 @@ import { UserEntityService } from '@/core/entities/UserEntityService.js'; import { ApDeliverManagerService } from '@/core/activitypub/ApDeliverManagerService.js'; import { ApRendererService } from '@/core/activitypub/ApRendererService.js'; import { bindThis } from '@/decorators.js'; +import { RoleService } from '@/core/RoleService.js'; @Injectable() export class NotePiningService { @@ -30,6 +31,7 @@ export class NotePiningService { private userEntityService: UserEntityService, private idService: IdService, + private roleService: RoleService, private relayService: RelayService, private apDeliverManagerService: ApDeliverManagerService, private apRendererService: ApRendererService, @@ -55,7 +57,7 @@ export class NotePiningService { const pinings = await this.userNotePiningsRepository.findBy({ userId: user.id }); - if (pinings.length >= 5) { + if (pinings.length >= (await this.roleService.getUserRoleOptions(user.id)).pinLimit) { throw new IdentifiableError('15a018eb-58e5-4da1-93be-330fcc5e4e1a', 'You can not pin notes any more.'); } -- cgit v1.2.3-freya