improve moderation log
This commit is contained in:
@@ -9,6 +9,7 @@ import { Endpoint } from '@/server/api/endpoint-base.js';
|
||||
import type { UsersRepository, UserProfilesRepository } from '@/models/_.js';
|
||||
import { DI } from '@/di-symbols.js';
|
||||
import { secureRndstr } from '@/misc/secure-rndstr.js';
|
||||
import { ModerationLogService } from '@/core/ModerationLogService.js';
|
||||
|
||||
export const meta = {
|
||||
tags: ['admin'],
|
||||
@@ -46,8 +47,10 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||
|
||||
@Inject(DI.userProfilesRepository)
|
||||
private userProfilesRepository: UserProfilesRepository,
|
||||
|
||||
private moderationLogService: ModerationLogService,
|
||||
) {
|
||||
super(meta, paramDef, async (ps) => {
|
||||
super(meta, paramDef, async (ps, me) => {
|
||||
const user = await this.usersRepository.findOneBy({ id: ps.userId });
|
||||
|
||||
if (user == null) {
|
||||
@@ -69,6 +72,10 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||
password: hash,
|
||||
});
|
||||
|
||||
this.moderationLogService.log(me, 'resetPassword', {
|
||||
targetId: user.id,
|
||||
});
|
||||
|
||||
return {
|
||||
password: passwd,
|
||||
};
|
||||
|
Reference in New Issue
Block a user