From 7b7bc8b7b346df7e6d1af1b4752edb87ec1c4e05 Mon Sep 17 00:00:00 2001 From: dakkar Date: Wed, 9 Oct 2024 17:15:27 +0100 Subject: [PATCH] use injected meta in claim-achievement.ts --- .../src/server/api/endpoints/i/claim-achievement.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/backend/src/server/api/endpoints/i/claim-achievement.ts b/packages/backend/src/server/api/endpoints/i/claim-achievement.ts index 73231e8e09..c642b05f5f 100644 --- a/packages/backend/src/server/api/endpoints/i/claim-achievement.ts +++ b/packages/backend/src/server/api/endpoints/i/claim-achievement.ts @@ -3,10 +3,11 @@ * SPDX-License-Identifier: AGPL-3.0-only */ +import { DI } from '@/di-symbols.js'; import { Injectable } from '@nestjs/common'; import { Endpoint } from '@/server/api/endpoint-base.js'; import { AchievementService, ACHIEVEMENT_TYPES } from '@/core/AchievementService.js'; -import { MetaService } from '@/core/MetaService.js'; +import type { MiMeta } from '@/models/_.js'; export const meta = { requireCredential: true, @@ -25,12 +26,13 @@ export const paramDef = { @Injectable() export default class extends Endpoint { // eslint-disable-line import/no-default-export constructor( + @Inject(DI.meta) + private serverSettings: MiMeta, + private achievementService: AchievementService, - private metaService: MetaService, ) { super(meta, paramDef, async (ps, me) => { - const meta = await this.metaService.fetch(); - if (!meta.enableAchievements) return; + if (!this.serverSettings.enableAchievements) return; await this.achievementService.create(me.id, ps.name); });