Update roles.vue

This commit is contained in:
syuilo 2024-09-01 14:29:46 +09:00
parent 42aada48a4
commit 1488b67066

View file

@ -239,7 +239,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { computed, reactive, ref } from 'vue'; import { computed, inject, reactive, ref } from 'vue';
import XHeader from './_header_.vue'; import XHeader from './_header_.vue';
import MkInput from '@/components/MkInput.vue'; import MkInput from '@/components/MkInput.vue';
import MkFolder from '@/components/MkFolder.vue'; import MkFolder from '@/components/MkFolder.vue';
@ -251,11 +251,13 @@ import * as os from '@/os.js';
import { misskeyApi } from '@/scripts/misskey-api.js'; import { misskeyApi } from '@/scripts/misskey-api.js';
import { i18n } from '@/i18n.js'; import { i18n } from '@/i18n.js';
import { definePageMetadata } from '@/scripts/page-metadata.js'; import { definePageMetadata } from '@/scripts/page-metadata.js';
import { instance, fetchServerMetadata } from '@/server-metadata.js'; import { fetchServerMetadata } from '@/server-metadata.js';
import MkFoldableSection from '@/components/MkFoldableSection.vue'; import MkFoldableSection from '@/components/MkFoldableSection.vue';
import { ROLE_POLICIES } from '@/const.js'; import { ROLE_POLICIES } from '@/const.js';
import { useRouter } from '@/router/supplier.js'; import { useRouter } from '@/router/supplier.js';
const serverMetadata = inject('serverMetadata');
const router = useRouter(); const router = useRouter();
const baseRoleQ = ref(''); const baseRoleQ = ref('');
@ -263,7 +265,7 @@ const roles = await misskeyApi('admin/roles/list');
const policies = reactive<Record<typeof ROLE_POLICIES[number], any>>({}); const policies = reactive<Record<typeof ROLE_POLICIES[number], any>>({});
for (const ROLE_POLICY of ROLE_POLICIES) { for (const ROLE_POLICY of ROLE_POLICIES) {
policies[ROLE_POLICY] = instance.policies[ROLE_POLICY]; policies[ROLE_POLICY] = serverMetadata.policies[ROLE_POLICY];
} }
function matchQuery(keywords: string[]): boolean { function matchQuery(keywords: string[]): boolean {