mirror of
https://github.com/misskey-dev/misskey.git
synced 2026-05-14 14:35:38 +02:00
enhance: Add canCreateChannel role policy (#17121)
* Initial plan * Add canCreateChannel role policy to control channel creation Co-authored-by: syuilo <4439005+syuilo@users.noreply.github.com> * Add canCreateChannel to getUserPolicies return value Co-authored-by: syuilo <4439005+syuilo@users.noreply.github.com> * Add canCreateChannel translations for en-US and ja-JP Co-authored-by: syuilo <4439005+syuilo@users.noreply.github.com> * Add canCreateChannel to misskey-js rolePolicies array Co-authored-by: syuilo <4439005+syuilo@users.noreply.github.com> * Add frontend UI for canCreateChannel policy configuration Co-authored-by: syuilo <4439005+syuilo@users.noreply.github.com> * fix: build autogen files * 🎨 * migrate * fix: unnecessary changes to non-Japanese locales --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: syuilo <4439005+syuilo@users.noreply.github.com> Co-authored-by: kakkokari-gtyih <67428053+kakkokari-gtyih@users.noreply.github.com>
This commit is contained in:
@@ -47,6 +47,7 @@ export type RolePolicies = {
|
||||
canSearchUsers: boolean;
|
||||
canUseTranslator: boolean;
|
||||
canHideAds: boolean;
|
||||
canCreateChannel: boolean;
|
||||
driveCapacityMb: number;
|
||||
maxFileSizeMb: number;
|
||||
alwaysMarkNsfw: boolean;
|
||||
@@ -88,6 +89,7 @@ export const DEFAULT_POLICIES: RolePolicies = {
|
||||
canSearchUsers: true,
|
||||
canUseTranslator: true,
|
||||
canHideAds: false,
|
||||
canCreateChannel: true,
|
||||
driveCapacityMb: 100,
|
||||
maxFileSizeMb: 30,
|
||||
alwaysMarkNsfw: false,
|
||||
@@ -410,6 +412,7 @@ export class RoleService implements OnApplicationShutdown, OnModuleInit {
|
||||
canSearchUsers: calc('canSearchUsers', vs => vs.some(v => v === true)),
|
||||
canUseTranslator: calc('canUseTranslator', vs => vs.some(v => v === true)),
|
||||
canHideAds: calc('canHideAds', vs => vs.some(v => v === true)),
|
||||
canCreateChannel: calc('canCreateChannel', vs => vs.some(v => v === true)),
|
||||
driveCapacityMb: calc('driveCapacityMb', vs => Math.max(...vs)),
|
||||
maxFileSizeMb: calc('maxFileSizeMb', vs => Math.max(...vs)),
|
||||
alwaysMarkNsfw: calc('alwaysMarkNsfw', vs => vs.some(v => v === true)),
|
||||
|
||||
@@ -224,6 +224,10 @@ export const packedRolePoliciesSchema = {
|
||||
type: 'boolean',
|
||||
optional: false, nullable: false,
|
||||
},
|
||||
canCreateChannel: {
|
||||
type: 'boolean',
|
||||
optional: false, nullable: false,
|
||||
},
|
||||
driveCapacityMb: {
|
||||
type: 'integer',
|
||||
optional: false, nullable: false,
|
||||
|
||||
@@ -22,6 +22,8 @@ export const meta = {
|
||||
|
||||
kind: 'write:channels',
|
||||
|
||||
requiredRolePolicy: 'canCreateChannel',
|
||||
|
||||
limit: {
|
||||
duration: ms('1hour'),
|
||||
max: 10,
|
||||
|
||||
Reference in New Issue
Block a user