fix(backend): ベースロールのポリシー変更時モデレーションログが残るように (#14418)
* fix(policies): ベースロールのポリシー変更時モデレーションログが残るように (MisskeyIO#700) (cherry picked from commit 80389a914049f6f26237fde8da7d4e1bd41452fc) * Update Changelog --------- Co-authored-by: まっちゃとーにゅ <17376330+u1-liquid@users.noreply.github.com>
This commit is contained in:
		| @@ -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<typeof meta, typeof paramDef> { // 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, | ||||
| 			}); | ||||
| 		}); | ||||
| 	} | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 かっこかり
					かっこかり