ロールのユーザーリストを非公開にできるように (#10987)

* ロールのユーザーリストを非公開にできるように

* Changelog update
This commit is contained in:
nenohi 2023-06-10 17:26:48 +09:00 committed by GitHub
parent f69627939b
commit f3a16bcd6d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 45 additions and 1 deletions

View file

@ -11,6 +11,17 @@
-
-->
## 13.x.x (unreleased)
### General
- ロールが付与されているユーザーリストを非公開にできるように
### Client
-
### Server
-
## 13.13.1

2
locales/index.d.ts vendored
View file

@ -1431,6 +1431,8 @@ export interface Locale {
"isConditionalRole": string;
"isPublic": string;
"descriptionOfIsPublic": string;
"isPublicUsers": string;
"descriptionOfIsPublicUsers": string;
"options": string;
"policies": string;
"baseRole": string;

View file

@ -1353,7 +1353,9 @@ _role:
condition: "条件"
isConditionalRole: "これはコンディショナルロールです。"
isPublic: "ロールを公開"
descriptionOfIsPublic: "ロールにアサインされたユーザーを誰でも見ることができます。また、ユーザーのプロフィールでこのロールが表示されます。"
descriptionOfIsPublic: "ユーザーのプロフィールでこのロールが表示されます。"
isPublicUsers: "ユーザーリストを公開"
descriptionOfIsPublicUsers: "ロールにアサインされたユーザーのリストを誰でも見ることができます。"
options: "オプション"
policies: "ポリシー"
baseRole: "ベースロール"

View file

@ -0,0 +1,11 @@
export class roleuserhidden1686381571997 {
name = 'roleuserhidden1686381571997'
async up(queryRunner) {
await queryRunner.query(`ALTER TABLE "role" ADD "isPublicUsers" boolean NOT NULL DEFAULT true`);
}
async down(queryRunner) {
await queryRunner.query(`ALTER TABLE "role" DROP COLUMN "isPublicUsers"`);
}
}

View file

@ -167,6 +167,11 @@ export class Role {
})
public displayOrder: number;
@Column('boolean', {
default: true,
})
public isPublicUsers: boolean;
@Column('jsonb', {
default: { },
})

View file

@ -26,6 +26,7 @@ export const paramDef = {
isModerator: { type: 'boolean' },
isAdministrator: { type: 'boolean' },
isExplorable: { type: 'boolean', default: false }, // optional for backward compatibility
isPublicUsers: { type: 'boolean', default: true }, // optional for backward compatibility
asBadge: { type: 'boolean' },
canEditMembersByModerator: { type: 'boolean' },
displayOrder: { type: 'number' },
@ -78,6 +79,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
isAdministrator: ps.isAdministrator,
isModerator: ps.isModerator,
isExplorable: ps.isExplorable,
isPublicUsers: ps.isPublicUsers,
asBadge: ps.asBadge,
canEditMembersByModerator: ps.canEditMembersByModerator,
displayOrder: ps.displayOrder,

View file

@ -34,6 +34,7 @@ export const paramDef = {
isModerator: { type: 'boolean' },
isAdministrator: { type: 'boolean' },
isExplorable: { type: 'boolean' },
isPublicUsers: { type: 'boolean' },
asBadge: { type: 'boolean' },
canEditMembersByModerator: { type: 'boolean' },
displayOrder: { type: 'number' },
@ -87,6 +88,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
isModerator: ps.isModerator,
isAdministrator: ps.isAdministrator,
isExplorable: ps.isExplorable,
isPublicUsers: ps.isPublicUsers,
asBadge: ps.asBadge,
canEditMembersByModerator: ps.canEditMembersByModerator,
displayOrder: ps.displayOrder,

View file

@ -54,6 +54,9 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
if (role == null) {
throw new ApiError(meta.errors.noSuchRole);
}
if (!role.isPublicUsers) {
return [];
}
const query = this.queryService.makePaginationQuery(this.roleAssignmentsRepository.createQueryBuilder('assign'), ps.sinceId, ps.untilId)
.andWhere('assign.roleId = :roleId', { roleId: role.id })

View file

@ -63,6 +63,11 @@
<template #caption>{{ i18n.ts._role.descriptionOfIsExplorable }}</template>
</MkSwitch>
<MkSwitch v-model="role.isPublicUsers" :readonly="readonly">
<template #label>{{ i18n.ts._role.isPublicUsers }}</template>
<template #caption>{{ i18n.ts._role.descriptionOfIsPublicUsers }}</template>
</MkSwitch>
<FormSlot>
<template #label><i class="ti ti-license"></i> {{ i18n.ts._role.policies }}</template>
<div class="_gaps_s">
@ -501,6 +506,7 @@ const save = throttle(100, () => {
isModerator: role.isModerator,
isPublic: role.isPublic,
isExplorable: role.isExplorable,
isPublicUsers: role.isPublicUsers,
asBadge: role.asBadge,
canEditMembersByModerator: role.canEditMembersByModerator,
policies: role.policies,