From 06684fe49b545be7dcfbf78153f8682a8a8de4e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=8B=E3=81=A3=E3=81=93=E3=81=8B=E3=82=8A?= <67428053+kakkokari-gtyih@users.noreply.github.com> Date: Sat, 17 Aug 2024 12:07:00 +0900 Subject: [PATCH] =?UTF-8?q?fix(backend):=20=E3=83=99=E3=83=BC=E3=82=B9?= =?UTF-8?q?=E3=83=AD=E3=83=BC=E3=83=AB=E3=81=AE=E3=83=9D=E3=83=AA=E3=82=B7?= =?UTF-8?q?=E3=83=BC=E5=A4=89=E6=9B=B4=E6=99=82=E3=83=A2=E3=83=87=E3=83=AC?= =?UTF-8?q?=E3=83=BC=E3=82=B7=E3=83=A7=E3=83=B3=E3=83=AD=E3=82=B0=E3=81=8C?= =?UTF-8?q?=E6=AE=8B=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB=20(#14418)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix(policies): ベースロールのポリシー変更時モデレーションログが残るように (MisskeyIO#700) (cherry picked from commit 80389a914049f6f26237fde8da7d4e1bd41452fc) * Update Changelog --------- Co-authored-by: まっちゃとーにゅ <17376330+u1-liquid@users.noreply.github.com> --- CHANGELOG.md | 2 ++ .../admin/roles/update-default-policies.ts | 15 +++++++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index caf4fab977..bade07c9d3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,6 +28,8 @@ - キュー処理のつまりが改善される可能性があります - Fix: リバーシの対局設定の変更が反映されないのを修正 - Fix: 無制限にストリーミングのチャンネルに接続できる問題を修正 +- Fix: ベースロールのポリシーを変更した際にモデログに記録されないのを修正 + (Cherry-picked from https://github.com/MisskeyIO/misskey/pull/700) ## 2024.7.0 diff --git a/packages/backend/src/server/api/endpoints/admin/roles/update-default-policies.ts b/packages/backend/src/server/api/endpoints/admin/roles/update-default-policies.ts index d7209965db..5cf49670be 100644 --- a/packages/backend/src/server/api/endpoints/admin/roles/update-default-policies.ts +++ b/packages/backend/src/server/api/endpoints/admin/roles/update-default-policies.ts @@ -7,6 +7,7 @@ import { Injectable } from '@nestjs/common'; import { Endpoint } from '@/server/api/endpoint-base.js'; import { GlobalEventService } from '@/core/GlobalEventService.js'; import { MetaService } from '@/core/MetaService.js'; +import { ModerationLogService } from '@/core/ModerationLogService.js'; export const meta = { tags: ['admin', 'role'], @@ -33,12 +34,22 @@ export default class extends Endpoint { // eslint- constructor( private metaService: MetaService, private globalEventService: GlobalEventService, + private moderationLogService: ModerationLogService, ) { - super(meta, paramDef, async (ps) => { + super(meta, paramDef, async (ps, me) => { + const before = await this.metaService.fetch(true); + await this.metaService.update({ policies: ps.policies, }); - this.globalEventService.publishInternalEvent('policiesUpdated', ps.policies); + + const after = await this.metaService.fetch(true); + + this.globalEventService.publishInternalEvent('policiesUpdated', after.policies); + this.moderationLogService.log(me, 'updateServerSettings', { + before: before.policies, + after: after.policies, + }); }); } }