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 ec602a0dc..dbe162614 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 2a0b678ed..2ac8d1554 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; +}