From afb37f0b0395c208a767b2e78e027f4426116e91 Mon Sep 17 00:00:00 2001 From: syuilo Date: Tue, 24 Oct 2023 14:38:15 +0900 Subject: [PATCH] :art: --- .../src/server/api/endpoints/get-avatar-decorations.ts | 5 ++++- packages/frontend/src/pages/settings/profile.vue | 7 +++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/packages/backend/src/server/api/endpoints/get-avatar-decorations.ts b/packages/backend/src/server/api/endpoints/get-avatar-decorations.ts index ec602a0dc5..dbe1626149 100644 --- a/packages/backend/src/server/api/endpoints/get-avatar-decorations.ts +++ b/packages/backend/src/server/api/endpoints/get-avatar-decorations.ts @@ -8,6 +8,7 @@ import { Inject, Injectable } from '@nestjs/common'; import { Endpoint } from '@/server/api/endpoint-base.js'; import { DI } from '@/di-symbols.js'; import { AvatarDecorationService } from '@/core/AvatarDecorationService.js'; +import { RoleService } from '@/core/RoleService.js'; export const meta = { tags: ['users'], @@ -63,16 +64,18 @@ export const paramDef = { export default class extends Endpoint { // eslint-disable-line import/no-default-export constructor( private avatarDecorationService: AvatarDecorationService, + private roleService: RoleService, ) { super(meta, paramDef, async (ps, me) => { const decorations = await this.avatarDecorationService.getAll(true); + const allRoles = await this.roleService.getRoles(); return decorations.map(decoration => ({ id: decoration.id, name: decoration.name, description: decoration.description, url: decoration.url, - roleIdsThatCanBeUsedThisDecoration: decoration.roleIdsThatCanBeUsedThisDecoration, + roleIdsThatCanBeUsedThisDecoration: decoration.roleIdsThatCanBeUsedThisDecoration.filter(roleId => allRoles.some(role => role.id === roleId)), })); }); } diff --git a/packages/frontend/src/pages/settings/profile.vue b/packages/frontend/src/pages/settings/profile.vue index 2a0b678ed1..2ac8d15545 100644 --- a/packages/frontend/src/pages/settings/profile.vue +++ b/packages/frontend/src/pages/settings/profile.vue @@ -96,6 +96,7 @@ SPDX-License-Identifier: AGPL-3.0-only >
{{ avatarDecoration.name }}
+ @@ -389,4 +390,10 @@ definePageMetadata({ font-weight: bold; margin-bottom: 20px; } + +.avatarDecorationLock { + position: absolute; + bottom: 12px; + right: 12px; +}