2023-01-12 14:02:26 +02:00
|
|
|
<template>
|
|
|
|
<div class="_gaps">
|
|
|
|
<MkInput v-model="name" :readonly="readonly">
|
|
|
|
<template #label>{{ i18n.ts._role.name }}</template>
|
|
|
|
</MkInput>
|
|
|
|
|
|
|
|
<MkTextarea v-model="description" :readonly="readonly">
|
|
|
|
<template #label>{{ i18n.ts._role.description }}</template>
|
|
|
|
</MkTextarea>
|
|
|
|
|
|
|
|
<MkInput v-model="color">
|
|
|
|
<template #label>{{ i18n.ts.color }}</template>
|
|
|
|
<template #caption>#RRGGBB</template>
|
|
|
|
</MkInput>
|
|
|
|
|
2023-01-13 01:23:52 +02:00
|
|
|
<MkSelect v-model="rolePermission" :readonly="readonly">
|
|
|
|
<template #label>{{ i18n.ts._role.permission }}</template>
|
2023-01-13 04:03:54 +02:00
|
|
|
<template #caption><div v-html="i18n.ts._role.descriptionOfPermission.replaceAll('\n', '<br>')"></div></template>
|
2023-01-13 01:22:23 +02:00
|
|
|
<option value="normal">{{ i18n.ts.normalUser }}</option>
|
2023-01-12 14:02:26 +02:00
|
|
|
<option value="moderator">{{ i18n.ts.moderator }}</option>
|
|
|
|
<option value="administrator">{{ i18n.ts.administrator }}</option>
|
|
|
|
</MkSelect>
|
|
|
|
|
2023-01-13 04:03:54 +02:00
|
|
|
<MkSelect v-model="target" :readonly="readonly">
|
|
|
|
<template #label>{{ i18n.ts._role.assignTarget }}</template>
|
|
|
|
<template #caption><div v-html="i18n.ts._role.descriptionOfAssignTarget.replaceAll('\n', '<br>')"></div></template>
|
|
|
|
<option value="manual">{{ i18n.ts._role.manual }}</option>
|
|
|
|
<option value="conditional">{{ i18n.ts._role.conditional }}</option>
|
|
|
|
</MkSelect>
|
|
|
|
|
|
|
|
<MkFolder v-if="target === 'conditional'" default-open>
|
|
|
|
<template #label>{{ i18n.ts._role.condition }}</template>
|
|
|
|
<div class="_gaps">
|
|
|
|
<RolesEditorFormula v-model="condFormula"/>
|
|
|
|
</div>
|
|
|
|
</MkFolder>
|
|
|
|
|
2023-01-12 14:02:26 +02:00
|
|
|
<FormSlot>
|
|
|
|
<template #label>{{ i18n.ts._role.options }}</template>
|
|
|
|
<div class="_gaps_s">
|
2023-01-15 09:52:12 +02:00
|
|
|
<MkFolder>
|
|
|
|
<template #label>{{ i18n.ts._role._options.rateLimitFactor }}</template>
|
|
|
|
<template #suffix>{{ options_rateLimitFactor_useDefault ? i18n.ts._role.useBaseValue : `${Math.floor(options_rateLimitFactor_value * 100)}%` }}</template>
|
|
|
|
<div class="_gaps">
|
|
|
|
<MkSwitch v-model="options_rateLimitFactor_useDefault" :readonly="readonly">
|
|
|
|
<template #label>{{ i18n.ts._role.useBaseValue }}</template>
|
|
|
|
</MkSwitch>
|
|
|
|
<MkRange :model-value="options_rateLimitFactor_value * 100" :min="30" :max="300" :step="10" :text-converter="(v) => `${v}%`" @update:model-value="v => options_rateLimitFactor_value = (v / 100)">
|
|
|
|
<template #caption>{{ i18n.ts._role._options.descriptionOfRateLimitFactor }}</template>
|
|
|
|
</MkRange>
|
|
|
|
</div>
|
|
|
|
</MkFolder>
|
|
|
|
|
2023-01-12 14:02:26 +02:00
|
|
|
<MkFolder>
|
|
|
|
<template #label>{{ i18n.ts._role._options.gtlAvailable }}</template>
|
|
|
|
<template #suffix>{{ options_gtlAvailable_useDefault ? i18n.ts._role.useBaseValue : (options_gtlAvailable_value ? i18n.ts.yes : i18n.ts.no) }}</template>
|
|
|
|
<div class="_gaps">
|
|
|
|
<MkSwitch v-model="options_gtlAvailable_useDefault" :readonly="readonly">
|
|
|
|
<template #label>{{ i18n.ts._role.useBaseValue }}</template>
|
|
|
|
</MkSwitch>
|
|
|
|
<MkSwitch v-model="options_gtlAvailable_value" :disabled="options_gtlAvailable_useDefault" :readonly="readonly">
|
|
|
|
<template #label>{{ i18n.ts.enable }}</template>
|
|
|
|
</MkSwitch>
|
|
|
|
</div>
|
|
|
|
</MkFolder>
|
|
|
|
|
|
|
|
<MkFolder>
|
|
|
|
<template #label>{{ i18n.ts._role._options.ltlAvailable }}</template>
|
|
|
|
<template #suffix>{{ options_ltlAvailable_useDefault ? i18n.ts._role.useBaseValue : (options_ltlAvailable_value ? i18n.ts.yes : i18n.ts.no) }}</template>
|
|
|
|
<div class="_gaps">
|
|
|
|
<MkSwitch v-model="options_ltlAvailable_useDefault" :readonly="readonly">
|
|
|
|
<template #label>{{ i18n.ts._role.useBaseValue }}</template>
|
|
|
|
</MkSwitch>
|
|
|
|
<MkSwitch v-model="options_ltlAvailable_value" :disabled="options_ltlAvailable_useDefault" :readonly="readonly">
|
|
|
|
<template #label>{{ i18n.ts.enable }}</template>
|
|
|
|
</MkSwitch>
|
|
|
|
</div>
|
|
|
|
</MkFolder>
|
|
|
|
|
|
|
|
<MkFolder>
|
|
|
|
<template #label>{{ i18n.ts._role._options.canPublicNote }}</template>
|
|
|
|
<template #suffix>{{ options_canPublicNote_useDefault ? i18n.ts._role.useBaseValue : (options_canPublicNote_value ? i18n.ts.yes : i18n.ts.no) }}</template>
|
|
|
|
<div class="_gaps">
|
|
|
|
<MkSwitch v-model="options_canPublicNote_useDefault" :readonly="readonly">
|
|
|
|
<template #label>{{ i18n.ts._role.useBaseValue }}</template>
|
|
|
|
</MkSwitch>
|
|
|
|
<MkSwitch v-model="options_canPublicNote_value" :disabled="options_canPublicNote_useDefault" :readonly="readonly">
|
|
|
|
<template #label>{{ i18n.ts.enable }}</template>
|
|
|
|
</MkSwitch>
|
|
|
|
</div>
|
|
|
|
</MkFolder>
|
|
|
|
|
2023-01-13 07:22:53 +02:00
|
|
|
<MkFolder>
|
|
|
|
<template #label>{{ i18n.ts._role._options.canInvite }}</template>
|
|
|
|
<template #suffix>{{ options_canInvite_useDefault ? i18n.ts._role.useBaseValue : (options_canInvite_value ? i18n.ts.yes : i18n.ts.no) }}</template>
|
|
|
|
<div class="_gaps">
|
|
|
|
<MkSwitch v-model="options_canInvite_useDefault" :readonly="readonly">
|
|
|
|
<template #label>{{ i18n.ts._role.useBaseValue }}</template>
|
|
|
|
</MkSwitch>
|
|
|
|
<MkSwitch v-model="options_canInvite_value" :disabled="options_canInvite_useDefault" :readonly="readonly">
|
|
|
|
<template #label>{{ i18n.ts.enable }}</template>
|
|
|
|
</MkSwitch>
|
|
|
|
</div>
|
|
|
|
</MkFolder>
|
|
|
|
|
2023-01-13 07:58:27 +02:00
|
|
|
<MkFolder>
|
|
|
|
<template #label>{{ i18n.ts._role._options.canManageCustomEmojis }}</template>
|
|
|
|
<template #suffix>{{ options_canManageCustomEmojis_useDefault ? i18n.ts._role.useBaseValue : (options_canManageCustomEmojis_value ? i18n.ts.yes : i18n.ts.no) }}</template>
|
|
|
|
<div class="_gaps">
|
|
|
|
<MkSwitch v-model="options_canManageCustomEmojis_useDefault" :readonly="readonly">
|
|
|
|
<template #label>{{ i18n.ts._role.useBaseValue }}</template>
|
|
|
|
</MkSwitch>
|
|
|
|
<MkSwitch v-model="options_canManageCustomEmojis_value" :disabled="options_canManageCustomEmojis_useDefault" :readonly="readonly">
|
|
|
|
<template #label>{{ i18n.ts.enable }}</template>
|
|
|
|
</MkSwitch>
|
|
|
|
</div>
|
|
|
|
</MkFolder>
|
|
|
|
|
2023-01-12 14:02:26 +02:00
|
|
|
<MkFolder>
|
|
|
|
<template #label>{{ i18n.ts._role._options.driveCapacity }}</template>
|
|
|
|
<template #suffix>{{ options_driveCapacityMb_useDefault ? i18n.ts._role.useBaseValue : (options_driveCapacityMb_value + 'MB') }}</template>
|
|
|
|
<div class="_gaps">
|
|
|
|
<MkSwitch v-model="options_driveCapacityMb_useDefault" :readonly="readonly">
|
|
|
|
<template #label>{{ i18n.ts._role.useBaseValue }}</template>
|
|
|
|
</MkSwitch>
|
|
|
|
<MkInput v-model="options_driveCapacityMb_value" :disabled="options_driveCapacityMb_useDefault" type="number" :readonly="readonly">
|
|
|
|
<template #suffix>MB</template>
|
|
|
|
</MkInput>
|
|
|
|
</div>
|
|
|
|
</MkFolder>
|
|
|
|
|
2023-01-14 11:04:56 +02:00
|
|
|
<MkFolder>
|
|
|
|
<template #label>{{ i18n.ts._role._options.pinMax }}</template>
|
|
|
|
<template #suffix>{{ options_pinLimit_useDefault ? i18n.ts._role.useBaseValue : (options_pinLimit_value) }}</template>
|
|
|
|
<div class="_gaps">
|
|
|
|
<MkSwitch v-model="options_pinLimit_useDefault" :readonly="readonly">
|
|
|
|
<template #label>{{ i18n.ts._role.useBaseValue }}</template>
|
|
|
|
</MkSwitch>
|
|
|
|
<MkInput v-model="options_pinLimit_value" :disabled="options_pinLimit_useDefault" type="number" :readonly="readonly">
|
|
|
|
</MkInput>
|
|
|
|
</div>
|
|
|
|
</MkFolder>
|
|
|
|
|
2023-01-12 14:02:26 +02:00
|
|
|
<MkFolder>
|
|
|
|
<template #label>{{ i18n.ts._role._options.antennaMax }}</template>
|
|
|
|
<template #suffix>{{ options_antennaLimit_useDefault ? i18n.ts._role.useBaseValue : (options_antennaLimit_value) }}</template>
|
|
|
|
<div class="_gaps">
|
|
|
|
<MkSwitch v-model="options_antennaLimit_useDefault" :readonly="readonly">
|
|
|
|
<template #label>{{ i18n.ts._role.useBaseValue }}</template>
|
|
|
|
</MkSwitch>
|
|
|
|
<MkInput v-model="options_antennaLimit_value" :disabled="options_antennaLimit_useDefault" type="number" :readonly="readonly">
|
|
|
|
</MkInput>
|
|
|
|
</div>
|
|
|
|
</MkFolder>
|
2023-01-14 01:04:38 +02:00
|
|
|
|
|
|
|
<MkFolder>
|
|
|
|
<template #label>{{ i18n.ts._role._options.wordMuteMax }}</template>
|
|
|
|
<template #suffix>{{ options_wordMuteLimit_useDefault ? i18n.ts._role.useBaseValue : (options_wordMuteLimit_value) }}</template>
|
|
|
|
<div class="_gaps">
|
|
|
|
<MkSwitch v-model="options_wordMuteLimit_useDefault" :readonly="readonly">
|
|
|
|
<template #label>{{ i18n.ts._role.useBaseValue }}</template>
|
|
|
|
</MkSwitch>
|
|
|
|
<MkInput v-model="options_wordMuteLimit_value" :disabled="options_wordMuteLimit_useDefault" type="number" :readonly="readonly">
|
|
|
|
<template #suffix>chars</template>
|
|
|
|
</MkInput>
|
|
|
|
</div>
|
|
|
|
</MkFolder>
|
2023-01-14 03:48:11 +02:00
|
|
|
|
|
|
|
<MkFolder>
|
|
|
|
<template #label>{{ i18n.ts._role._options.webhookMax }}</template>
|
|
|
|
<template #suffix>{{ options_webhookLimit_useDefault ? i18n.ts._role.useBaseValue : (options_webhookLimit_value) }}</template>
|
|
|
|
<div class="_gaps">
|
|
|
|
<MkSwitch v-model="options_webhookLimit_useDefault" :readonly="readonly">
|
|
|
|
<template #label>{{ i18n.ts._role.useBaseValue }}</template>
|
|
|
|
</MkSwitch>
|
|
|
|
<MkInput v-model="options_webhookLimit_value" :disabled="options_webhookLimit_useDefault" type="number" :readonly="readonly">
|
|
|
|
</MkInput>
|
|
|
|
</div>
|
|
|
|
</MkFolder>
|
2023-01-14 09:14:24 +02:00
|
|
|
|
|
|
|
<MkFolder>
|
|
|
|
<template #label>{{ i18n.ts._role._options.clipMax }}</template>
|
|
|
|
<template #suffix>{{ options_clipLimit_useDefault ? i18n.ts._role.useBaseValue : (options_clipLimit_value) }}</template>
|
|
|
|
<div class="_gaps">
|
|
|
|
<MkSwitch v-model="options_clipLimit_useDefault" :readonly="readonly">
|
|
|
|
<template #label>{{ i18n.ts._role.useBaseValue }}</template>
|
|
|
|
</MkSwitch>
|
|
|
|
<MkInput v-model="options_clipLimit_value" :disabled="options_clipLimit_useDefault" type="number" :readonly="readonly">
|
|
|
|
</MkInput>
|
|
|
|
</div>
|
|
|
|
</MkFolder>
|
|
|
|
|
|
|
|
<MkFolder>
|
|
|
|
<template #label>{{ i18n.ts._role._options.noteEachClipsMax }}</template>
|
|
|
|
<template #suffix>{{ options_noteEachClipsLimit_useDefault ? i18n.ts._role.useBaseValue : (options_noteEachClipsLimit_value) }}</template>
|
|
|
|
<div class="_gaps">
|
|
|
|
<MkSwitch v-model="options_noteEachClipsLimit_useDefault" :readonly="readonly">
|
|
|
|
<template #label>{{ i18n.ts._role.useBaseValue }}</template>
|
|
|
|
</MkSwitch>
|
|
|
|
<MkInput v-model="options_noteEachClipsLimit_value" :disabled="options_noteEachClipsLimit_useDefault" type="number" :readonly="readonly">
|
|
|
|
</MkInput>
|
|
|
|
</div>
|
|
|
|
</MkFolder>
|
2023-01-14 10:38:16 +02:00
|
|
|
|
|
|
|
<MkFolder>
|
|
|
|
<template #label>{{ i18n.ts._role._options.userListMax }}</template>
|
2023-01-14 10:49:02 +02:00
|
|
|
<template #suffix>{{ options_userListLimit_useDefault ? i18n.ts._role.useBaseValue : (options_userListLimit_value) }}</template>
|
2023-01-14 10:38:16 +02:00
|
|
|
<div class="_gaps">
|
2023-01-14 10:49:02 +02:00
|
|
|
<MkSwitch v-model="options_userListLimit_useDefault" :readonly="readonly">
|
2023-01-14 10:38:16 +02:00
|
|
|
<template #label>{{ i18n.ts._role.useBaseValue }}</template>
|
|
|
|
</MkSwitch>
|
2023-01-14 10:49:02 +02:00
|
|
|
<MkInput v-model="options_userListLimit_value" :disabled="options_userListLimit_useDefault" type="number" :readonly="readonly">
|
2023-01-14 10:38:16 +02:00
|
|
|
</MkInput>
|
|
|
|
</div>
|
|
|
|
</MkFolder>
|
|
|
|
|
|
|
|
<MkFolder>
|
|
|
|
<template #label>{{ i18n.ts._role._options.userEachUserListsMax }}</template>
|
|
|
|
<template #suffix>{{ options_userEachUserListsLimit_useDefault ? i18n.ts._role.useBaseValue : (options_userEachUserListsLimit_value) }}</template>
|
|
|
|
<div class="_gaps">
|
|
|
|
<MkSwitch v-model="options_userEachUserListsLimit_useDefault" :readonly="readonly">
|
|
|
|
<template #label>{{ i18n.ts._role.useBaseValue }}</template>
|
|
|
|
</MkSwitch>
|
|
|
|
<MkInput v-model="options_userEachUserListsLimit_value" :disabled="options_userEachUserListsLimit_useDefault" type="number" :readonly="readonly">
|
|
|
|
</MkInput>
|
|
|
|
</div>
|
|
|
|
</MkFolder>
|
2023-01-12 14:02:26 +02:00
|
|
|
</div>
|
|
|
|
</FormSlot>
|
|
|
|
|
|
|
|
<MkSwitch v-model="canEditMembersByModerator" :readonly="readonly">
|
|
|
|
<template #label>{{ i18n.ts._role.canEditMembersByModerator }}</template>
|
|
|
|
<template #caption>{{ i18n.ts._role.descriptionOfCanEditMembersByModerator }}</template>
|
|
|
|
</MkSwitch>
|
|
|
|
|
|
|
|
<MkSwitch v-model="isPublic" :readonly="readonly">
|
|
|
|
<template #label>{{ i18n.ts._role.isPublic }}</template>
|
|
|
|
<template #caption>{{ i18n.ts._role.descriptionOfIsPublic }}</template>
|
|
|
|
</MkSwitch>
|
|
|
|
|
|
|
|
<div v-if="!readonly" class="_buttons">
|
|
|
|
<MkButton primary rounded @click="save"><i class="ti ti-check"></i> {{ role ? i18n.ts.save : i18n.ts.create }}</MkButton>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts" setup>
|
2023-01-13 04:03:54 +02:00
|
|
|
import { computed, watch } from 'vue';
|
|
|
|
import { v4 as uuid } from 'uuid';
|
|
|
|
import RolesEditorFormula from './RolesEditorFormula.vue';
|
2023-01-12 14:02:26 +02:00
|
|
|
import MkInput from '@/components/MkInput.vue';
|
|
|
|
import MkSelect from '@/components/MkSelect.vue';
|
|
|
|
import MkTextarea from '@/components/MkTextarea.vue';
|
|
|
|
import MkFolder from '@/components/MkFolder.vue';
|
|
|
|
import MkSwitch from '@/components/MkSwitch.vue';
|
|
|
|
import MkButton from '@/components/MkButton.vue';
|
2023-01-15 09:52:12 +02:00
|
|
|
import MkRange from '@/components/MkRange.vue';
|
2023-01-12 14:02:26 +02:00
|
|
|
import FormSlot from '@/components/form/slot.vue';
|
|
|
|
import * as os from '@/os';
|
|
|
|
import { i18n } from '@/i18n';
|
2023-01-15 09:52:12 +02:00
|
|
|
import { instance } from '@/instance';
|
2023-01-12 14:02:26 +02:00
|
|
|
|
|
|
|
const emit = defineEmits<{
|
|
|
|
(ev: 'created', payload: any): void;
|
|
|
|
(ev: 'updated'): void;
|
|
|
|
}>();
|
|
|
|
|
|
|
|
const props = defineProps<{
|
|
|
|
role?: any;
|
|
|
|
readonly?: boolean;
|
|
|
|
}>();
|
|
|
|
|
|
|
|
const role = props.role;
|
|
|
|
|
|
|
|
let name = $ref(role?.name ?? 'New Role');
|
|
|
|
let description = $ref(role?.description ?? '');
|
2023-01-13 01:23:52 +02:00
|
|
|
let rolePermission = $ref(role?.isAdministrator ? 'administrator' : role?.isModerator ? 'moderator' : 'normal');
|
2023-01-12 14:02:26 +02:00
|
|
|
let color = $ref(role?.color ?? null);
|
2023-01-13 04:03:54 +02:00
|
|
|
let target = $ref(role?.target ?? 'manual');
|
|
|
|
let condFormula = $ref(role?.condFormula ?? { id: uuid(), type: 'isRemote' });
|
2023-01-12 14:02:26 +02:00
|
|
|
let isPublic = $ref(role?.isPublic ?? false);
|
|
|
|
let canEditMembersByModerator = $ref(role?.canEditMembersByModerator ?? false);
|
|
|
|
let options_gtlAvailable_useDefault = $ref(role?.options?.gtlAvailable?.useDefault ?? true);
|
2023-01-15 09:52:12 +02:00
|
|
|
let options_gtlAvailable_value = $ref(role?.options?.gtlAvailable?.value ?? instance.baseRole.gtlAvailable);
|
2023-01-12 14:02:26 +02:00
|
|
|
let options_ltlAvailable_useDefault = $ref(role?.options?.ltlAvailable?.useDefault ?? true);
|
2023-01-15 09:52:12 +02:00
|
|
|
let options_ltlAvailable_value = $ref(role?.options?.ltlAvailable?.value ?? instance.baseRole.ltlAvailable);
|
2023-01-12 14:02:26 +02:00
|
|
|
let options_canPublicNote_useDefault = $ref(role?.options?.canPublicNote?.useDefault ?? true);
|
2023-01-15 09:52:12 +02:00
|
|
|
let options_canPublicNote_value = $ref(role?.options?.canPublicNote?.value ?? instance.baseRole.canPublicNote);
|
2023-01-13 07:22:53 +02:00
|
|
|
let options_canInvite_useDefault = $ref(role?.options?.canInvite?.useDefault ?? true);
|
2023-01-15 09:52:12 +02:00
|
|
|
let options_canInvite_value = $ref(role?.options?.canInvite?.value ?? instance.baseRole.canInvite);
|
2023-01-13 07:58:27 +02:00
|
|
|
let options_canManageCustomEmojis_useDefault = $ref(role?.options?.canManageCustomEmojis?.useDefault ?? true);
|
2023-01-15 09:52:12 +02:00
|
|
|
let options_canManageCustomEmojis_value = $ref(role?.options?.canManageCustomEmojis?.value ?? instance.baseRole.canManageCustomEmojis);
|
2023-01-12 14:02:26 +02:00
|
|
|
let options_driveCapacityMb_useDefault = $ref(role?.options?.driveCapacityMb?.useDefault ?? true);
|
2023-01-15 09:52:12 +02:00
|
|
|
let options_driveCapacityMb_value = $ref(role?.options?.driveCapacityMb?.value ?? instance.baseRole.driveCapacityMb);
|
2023-01-14 11:04:56 +02:00
|
|
|
let options_pinLimit_useDefault = $ref(role?.options?.pinLimit?.useDefault ?? true);
|
2023-01-15 09:52:12 +02:00
|
|
|
let options_pinLimit_value = $ref(role?.options?.pinLimit?.value ?? instance.baseRole.pinLimit);
|
2023-01-12 14:02:26 +02:00
|
|
|
let options_antennaLimit_useDefault = $ref(role?.options?.antennaLimit?.useDefault ?? true);
|
2023-01-15 09:52:12 +02:00
|
|
|
let options_antennaLimit_value = $ref(role?.options?.antennaLimit?.value ?? instance.baseRole.antennaLimit);
|
2023-01-14 01:04:38 +02:00
|
|
|
let options_wordMuteLimit_useDefault = $ref(role?.options?.wordMuteLimit?.useDefault ?? true);
|
2023-01-15 09:52:12 +02:00
|
|
|
let options_wordMuteLimit_value = $ref(role?.options?.wordMuteLimit?.value ?? instance.baseRole.wordMuteLimit);
|
2023-01-14 03:48:11 +02:00
|
|
|
let options_webhookLimit_useDefault = $ref(role?.options?.webhookLimit?.useDefault ?? true);
|
2023-01-15 09:52:12 +02:00
|
|
|
let options_webhookLimit_value = $ref(role?.options?.webhookLimit?.value ?? instance.baseRole.webhookLimit);
|
2023-01-14 09:14:24 +02:00
|
|
|
let options_clipLimit_useDefault = $ref(role?.options?.clipLimit?.useDefault ?? true);
|
2023-01-15 09:52:12 +02:00
|
|
|
let options_clipLimit_value = $ref(role?.options?.clipLimit?.value ?? instance.baseRole.clipLimit);
|
2023-01-14 09:14:24 +02:00
|
|
|
let options_noteEachClipsLimit_useDefault = $ref(role?.options?.noteEachClipsLimit?.useDefault ?? true);
|
2023-01-15 09:52:12 +02:00
|
|
|
let options_noteEachClipsLimit_value = $ref(role?.options?.noteEachClipsLimit?.value ?? instance.baseRole.noteEachClipsLimit);
|
2023-01-14 10:38:16 +02:00
|
|
|
let options_userListLimit_useDefault = $ref(role?.options?.userListLimit?.useDefault ?? true);
|
2023-01-15 09:52:12 +02:00
|
|
|
let options_userListLimit_value = $ref(role?.options?.userListLimit?.value ?? instance.baseRole.userListLimit);
|
2023-01-14 10:38:16 +02:00
|
|
|
let options_userEachUserListsLimit_useDefault = $ref(role?.options?.userEachUserListsLimit?.useDefault ?? true);
|
2023-01-15 09:52:12 +02:00
|
|
|
let options_userEachUserListsLimit_value = $ref(role?.options?.userEachUserListsLimit?.value ?? instance.baseRole.userEachUserListsLimit);
|
|
|
|
let options_rateLimitFactor_useDefault = $ref(role?.options?.rateLimitFactor?.useDefault ?? true);
|
|
|
|
let options_rateLimitFactor_value = $ref(role?.options?.rateLimitFactor?.value ?? instance.baseRole.rateLimitFactor);
|
2023-01-12 14:02:26 +02:00
|
|
|
|
2023-01-13 04:04:58 +02:00
|
|
|
if (_DEV_) {
|
|
|
|
watch($$(condFormula), () => {
|
|
|
|
console.log(JSON.parse(JSON.stringify(condFormula)));
|
|
|
|
}, { deep: true });
|
|
|
|
}
|
2023-01-13 04:03:54 +02:00
|
|
|
|
2023-01-12 14:02:26 +02:00
|
|
|
function getOptions() {
|
|
|
|
return {
|
|
|
|
gtlAvailable: { useDefault: options_gtlAvailable_useDefault, value: options_gtlAvailable_value },
|
|
|
|
ltlAvailable: { useDefault: options_ltlAvailable_useDefault, value: options_ltlAvailable_value },
|
|
|
|
canPublicNote: { useDefault: options_canPublicNote_useDefault, value: options_canPublicNote_value },
|
2023-01-13 07:22:53 +02:00
|
|
|
canInvite: { useDefault: options_canInvite_useDefault, value: options_canInvite_value },
|
2023-01-13 07:58:27 +02:00
|
|
|
canManageCustomEmojis: { useDefault: options_canManageCustomEmojis_useDefault, value: options_canManageCustomEmojis_value },
|
2023-01-12 14:02:26 +02:00
|
|
|
driveCapacityMb: { useDefault: options_driveCapacityMb_useDefault, value: options_driveCapacityMb_value },
|
2023-01-14 11:04:56 +02:00
|
|
|
pinLimit: { useDefault: options_pinLimit_useDefault, value: options_pinLimit_value },
|
2023-01-12 14:02:26 +02:00
|
|
|
antennaLimit: { useDefault: options_antennaLimit_useDefault, value: options_antennaLimit_value },
|
2023-01-14 01:04:38 +02:00
|
|
|
wordMuteLimit: { useDefault: options_wordMuteLimit_useDefault, value: options_wordMuteLimit_value },
|
2023-01-14 03:48:11 +02:00
|
|
|
webhookLimit: { useDefault: options_webhookLimit_useDefault, value: options_webhookLimit_value },
|
2023-01-14 09:14:24 +02:00
|
|
|
clipLimit: { useDefault: options_clipLimit_useDefault, value: options_clipLimit_value },
|
|
|
|
noteEachClipsLimit: { useDefault: options_noteEachClipsLimit_useDefault, value: options_noteEachClipsLimit_value },
|
2023-01-14 10:38:16 +02:00
|
|
|
userListLimit: { useDefault: options_userListLimit_useDefault, value: options_userListLimit_value },
|
|
|
|
userEachUserListsLimit: { useDefault: options_userEachUserListsLimit_useDefault, value: options_userEachUserListsLimit_value },
|
2023-01-15 09:52:12 +02:00
|
|
|
rateLimitFactor: { useDefault: options_rateLimitFactor_useDefault, value: options_rateLimitFactor_value },
|
2023-01-12 14:02:26 +02:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
async function save() {
|
|
|
|
if (props.readonly) return;
|
|
|
|
if (role) {
|
|
|
|
os.apiWithDialog('admin/roles/update', {
|
|
|
|
roleId: role.id,
|
|
|
|
name,
|
|
|
|
description,
|
|
|
|
color: color === '' ? null : color,
|
2023-01-13 04:03:54 +02:00
|
|
|
target,
|
|
|
|
condFormula,
|
2023-01-13 01:23:52 +02:00
|
|
|
isAdministrator: rolePermission === 'administrator',
|
|
|
|
isModerator: rolePermission === 'moderator',
|
2023-01-12 14:02:26 +02:00
|
|
|
isPublic,
|
|
|
|
canEditMembersByModerator,
|
|
|
|
options: getOptions(),
|
|
|
|
});
|
|
|
|
emit('updated');
|
|
|
|
} else {
|
|
|
|
const created = await os.apiWithDialog('admin/roles/create', {
|
|
|
|
name,
|
|
|
|
description,
|
|
|
|
color: color === '' ? null : color,
|
2023-01-13 04:03:54 +02:00
|
|
|
target,
|
|
|
|
condFormula,
|
2023-01-13 01:23:52 +02:00
|
|
|
isAdministrator: rolePermission === 'administrator',
|
|
|
|
isModerator: rolePermission === 'moderator',
|
2023-01-12 14:02:26 +02:00
|
|
|
isPublic,
|
|
|
|
canEditMembersByModerator,
|
|
|
|
options: getOptions(),
|
|
|
|
});
|
|
|
|
emit('created', created);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" module>
|
|
|
|
|
|
|
|
</style>
|