forked from MisskeyIO/misskey
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(moderation): モデレーターがユーザーのアイコンもしくはバナー画像を未設定状態にできる機能を追加 (MisskeyIO…
…#222) Co-authored-by: まっちゃとーにゅ <[email protected]>
- Loading branch information
Showing
10 changed files
with
176 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
packages/backend/src/server/api/endpoints/admin/delete-user-avatar.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/* | ||
* SPDX-FileCopyrightText: syuilo and other misskey contributors | ||
* SPDX-License-Identifier: AGPL-3.0-only | ||
*/ | ||
|
||
import { Inject, Injectable } from '@nestjs/common'; | ||
import type { UsersRepository } from '@/models/_.js'; | ||
import { Endpoint } from '@/server/api/endpoint-base.js'; | ||
import { DI } from '@/di-symbols.js'; | ||
|
||
export const meta = { | ||
tags: ['admin'], | ||
|
||
requireCredential: true, | ||
requireModerator: true, | ||
} as const; | ||
|
||
export const paramDef = { | ||
type: 'object', | ||
properties: { | ||
userId: { type: 'string', format: 'misskey:id' }, | ||
}, | ||
required: ['userId'], | ||
} as const; | ||
|
||
// eslint-disable-next-line import/no-default-export | ||
@Injectable() | ||
export default class extends Endpoint<typeof meta, typeof paramDef> { | ||
constructor( | ||
@Inject(DI.usersRepository) | ||
private usersRepository: UsersRepository, | ||
) { | ||
super(meta, paramDef, async (ps, me) => { | ||
const user = await this.usersRepository.findOneBy({ id: ps.userId }); | ||
|
||
if (user == null) { | ||
throw new Error('user not found'); | ||
} | ||
|
||
await this.usersRepository.update(user.id, { | ||
avatar: null, | ||
avatarId: null, | ||
avatarUrl: null, | ||
avatarBlurhash: null, | ||
}); | ||
}); | ||
} | ||
} |
48 changes: 48 additions & 0 deletions
48
packages/backend/src/server/api/endpoints/admin/delete-user-banner.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/* | ||
* SPDX-FileCopyrightText: syuilo and other misskey contributors | ||
* SPDX-License-Identifier: AGPL-3.0-only | ||
*/ | ||
|
||
import { Inject, Injectable } from '@nestjs/common'; | ||
import type { UsersRepository } from '@/models/_.js'; | ||
import { Endpoint } from '@/server/api/endpoint-base.js'; | ||
import { DI } from '@/di-symbols.js'; | ||
|
||
export const meta = { | ||
tags: ['admin'], | ||
|
||
requireCredential: true, | ||
requireModerator: true, | ||
} as const; | ||
|
||
export const paramDef = { | ||
type: 'object', | ||
properties: { | ||
userId: { type: 'string', format: 'misskey:id' }, | ||
}, | ||
required: ['userId'], | ||
} as const; | ||
|
||
// eslint-disable-next-line import/no-default-export | ||
@Injectable() | ||
export default class extends Endpoint<typeof meta, typeof paramDef> { | ||
constructor( | ||
@Inject(DI.usersRepository) | ||
private usersRepository: UsersRepository, | ||
) { | ||
super(meta, paramDef, async (ps, me) => { | ||
const user = await this.usersRepository.findOneBy({ id: ps.userId }); | ||
|
||
if (user == null) { | ||
throw new Error('user not found'); | ||
} | ||
|
||
await this.usersRepository.update(user.id, { | ||
banner: null, | ||
bannerId: null, | ||
bannerUrl: null, | ||
bannerBlurhash: null, | ||
}); | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters