-.root {
-
-}
-
.main {
text-align: center;
From 74847bce303449124282a748fc50b1c6588288fc Mon Sep 17 00:00:00 2001
From: syuilo <4439005+syuilo@users.noreply.github.com>
Date: Mon, 28 Oct 2024 20:42:14 +0900
Subject: [PATCH 13/22] =?UTF-8?q?enhance:=20=E3=82=A2=E3=82=A4=E3=82=B3?=
=?UTF-8?q?=E3=83=B3=E3=83=87=E3=82=B3=E3=83=AC=E3=83=BC=E3=82=B7=E3=83=A7?=
=?UTF-8?q?=E3=83=B3=E7=AE=A1=E7=90=86=E7=94=BB=E9=9D=A2=E3=81=AE=E6=94=B9?=
=?UTF-8?q?=E5=96=84?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
CHANGELOG.md | 1 +
locales/index.d.ts | 4 +
locales/ja-JP.yml | 1 +
.../admin/avatar-decorations/create.ts | 57 ++++-
.../admin/avatar-decorations/list.ts | 3 -
.../pages/avatar-decoration-edit-dialog.vue | 220 ++++++++++++++++++
.../frontend/src/pages/avatar-decorations.vue | 172 +++++---------
.../settings/avatar-decoration.decoration.vue | 7 +-
.../settings/avatar-decoration.dialog.vue | 4 +-
packages/misskey-js/etc/misskey-js.api.md | 4 +
packages/misskey-js/src/autogen/endpoint.ts | 3 +-
packages/misskey-js/src/autogen/entities.ts | 1 +
packages/misskey-js/src/autogen/types.ts | 19 +-
13 files changed, 374 insertions(+), 122 deletions(-)
create mode 100644 packages/frontend/src/pages/avatar-decoration-edit-dialog.vue
diff --git a/CHANGELOG.md b/CHANGELOG.md
index cbd48b8b6c..52077f813f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -8,6 +8,7 @@
- Enhance: Bull DashboardでRelationship Queueの状態も確認できるように
(Cherry-picked from https://github.com/MisskeyIO/misskey/pull/751)
- Enhance: ドライブでソートができるように
+- Enhance: アイコンデコレーション管理画面の改善
- Enhance: 「単なるラッキー」の取得条件を変更
- Enhance: 投稿フォームでEscキーを押したときIME入力中ならフォームを閉じないように( #10866 )
- Enhance: MiAuth, OAuthの認可画面の改善
diff --git a/locales/index.d.ts b/locales/index.d.ts
index 9058c70496..440f24ac84 100644
--- a/locales/index.d.ts
+++ b/locales/index.d.ts
@@ -5214,6 +5214,10 @@ export interface Locale extends ILocale {
* アカウントを選択してください
*/
"pleaseSelectAccount": string;
+ /**
+ * 利用可能なロール
+ */
+ "availableRoles": string;
"_accountSettings": {
/**
* コンテンツの表示にログインを必須にする
diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml
index 1d426f1705..5d8e1a5e72 100644
--- a/locales/ja-JP.yml
+++ b/locales/ja-JP.yml
@@ -1299,6 +1299,7 @@ yourNameContainsProhibitedWordsDescription: "名前に禁止されている文
thisContentsAreMarkedAsSigninRequiredByAuthor: "投稿者により、表示にはログインが必要と設定されています"
lockdown: "ロックダウン"
pleaseSelectAccount: "アカウントを選択してください"
+availableRoles: "利用可能なロール"
_accountSettings:
requireSigninToViewContents: "コンテンツの表示にログインを必須にする"
diff --git a/packages/backend/src/server/api/endpoints/admin/avatar-decorations/create.ts b/packages/backend/src/server/api/endpoints/admin/avatar-decorations/create.ts
index fd21309818..87d80cbe80 100644
--- a/packages/backend/src/server/api/endpoints/admin/avatar-decorations/create.ts
+++ b/packages/backend/src/server/api/endpoints/admin/avatar-decorations/create.ts
@@ -6,6 +6,7 @@
import { Injectable } from '@nestjs/common';
import { Endpoint } from '@/server/api/endpoint-base.js';
import { AvatarDecorationService } from '@/core/AvatarDecorationService.js';
+import { IdService } from '@/core/IdService.js';
export const meta = {
tags: ['admin'],
@@ -13,6 +14,49 @@ export const meta = {
requireCredential: true,
requireRolePolicy: 'canManageAvatarDecorations',
kind: 'write:admin:avatar-decorations',
+
+ res: {
+ type: 'object',
+ optional: false, nullable: false,
+ properties: {
+ id: {
+ type: 'string',
+ optional: false, nullable: false,
+ format: 'id',
+ },
+ createdAt: {
+ type: 'string',
+ optional: false, nullable: false,
+ format: 'date-time',
+ },
+ updatedAt: {
+ type: 'string',
+ optional: false, nullable: true,
+ format: 'date-time',
+ },
+ name: {
+ type: 'string',
+ optional: false, nullable: false,
+ },
+ description: {
+ type: 'string',
+ optional: false, nullable: false,
+ },
+ url: {
+ type: 'string',
+ optional: false, nullable: false,
+ },
+ roleIdsThatCanBeUsedThisDecoration: {
+ type: 'array',
+ optional: false, nullable: false,
+ items: {
+ type: 'string',
+ optional: false, nullable: false,
+ format: 'id',
+ },
+ },
+ },
+ },
} as const;
export const paramDef = {
@@ -32,14 +76,25 @@ export const paramDef = {
export default class extends Endpoint
{ // eslint-disable-line import/no-default-export
constructor(
private avatarDecorationService: AvatarDecorationService,
+ private idService: IdService,
) {
super(meta, paramDef, async (ps, me) => {
- await this.avatarDecorationService.create({
+ const created = await this.avatarDecorationService.create({
name: ps.name,
description: ps.description,
url: ps.url,
roleIdsThatCanBeUsedThisDecoration: ps.roleIdsThatCanBeUsedThisDecoration,
}, me);
+
+ return {
+ id: created.id,
+ createdAt: this.idService.parse(created.id).date.toISOString(),
+ updatedAt: null,
+ name: created.name,
+ description: created.description,
+ url: created.url,
+ roleIdsThatCanBeUsedThisDecoration: created.roleIdsThatCanBeUsedThisDecoration,
+ };
});
}
}
diff --git a/packages/backend/src/server/api/endpoints/admin/avatar-decorations/list.ts b/packages/backend/src/server/api/endpoints/admin/avatar-decorations/list.ts
index aee90023e1..d785f085ac 100644
--- a/packages/backend/src/server/api/endpoints/admin/avatar-decorations/list.ts
+++ b/packages/backend/src/server/api/endpoints/admin/avatar-decorations/list.ts
@@ -4,10 +4,7 @@
*/
import { Inject, Injectable } from '@nestjs/common';
-import type { AnnouncementsRepository, AnnouncementReadsRepository } from '@/models/_.js';
-import type { MiAnnouncement } from '@/models/Announcement.js';
import { Endpoint } from '@/server/api/endpoint-base.js';
-import { QueryService } from '@/core/QueryService.js';
import { DI } from '@/di-symbols.js';
import { IdService } from '@/core/IdService.js';
import { AvatarDecorationService } from '@/core/AvatarDecorationService.js';
diff --git a/packages/frontend/src/pages/avatar-decoration-edit-dialog.vue b/packages/frontend/src/pages/avatar-decoration-edit-dialog.vue
new file mode 100644
index 0000000000..a834f1c5fd
--- /dev/null
+++ b/packages/frontend/src/pages/avatar-decoration-edit-dialog.vue
@@ -0,0 +1,220 @@
+
+
+
+
+ {{ avatarDecoration.name }}
+ New decoration
+
+
+
+
+
+
+ {{ i18n.ts.name }}
+
+
+ {{ i18n.ts.imageUrl }}
+
+
+ {{ i18n.ts.description }}
+
+
+ {{ i18n.ts.availableRoles }}
+ {{ rolesThatCanBeUsedThisDecoration.length === 0 ? i18n.ts.all : rolesThatCanBeUsedThisDecoration.length }}
+
+
+
{{ i18n.ts.add }}
+
+
+
+
+
+
+
+
+
{{ i18n.ts.delete }}
+
+
+
+ {{ props.avatarDecoration ? i18n.ts.update : i18n.ts.create }}
+
+
+
+
+
+
+
+
diff --git a/packages/frontend/src/pages/avatar-decorations.vue b/packages/frontend/src/pages/avatar-decorations.vue
index b97e7c0eea..a5cafb1678 100644
--- a/packages/frontend/src/pages/avatar-decorations.vue
+++ b/packages/frontend/src/pages/avatar-decorations.vue
@@ -5,92 +5,38 @@ SPDX-License-Identifier: AGPL-3.0-only
-
+
-
- {{ avatarDecoration.name }}
- {{ avatarDecoration.description }}
-
-
-
-
-
-
- {{ i18n.ts.name }}
-
-
- {{ i18n.ts.description }}
-
-
- {{ i18n.ts.imageUrl }}
-
-
- {{ i18n.ts.save }}
- {{ i18n.ts.delete }}
-
-
-
+
+
+
{{ avatarDecoration.name }}
+
-
+
diff --git a/packages/frontend/src/pages/settings/avatar-decoration.decoration.vue b/packages/frontend/src/pages/settings/avatar-decoration.decoration.vue
index f72a0b9383..3c9914b4e2 100644
--- a/packages/frontend/src/pages/settings/avatar-decoration.decoration.vue
+++ b/packages/frontend/src/pages/settings/avatar-decoration.decoration.vue
@@ -10,12 +10,12 @@ SPDX-License-Identifier: AGPL-3.0-only
>
{{ decoration.name }}
-
+
diff --git a/packages/frontend/src/pages/settings/avatar-decoration.dialog.vue b/packages/frontend/src/pages/settings/avatar-decoration.dialog.vue
index 853e536ea3..aa899ac649 100644
--- a/packages/frontend/src/pages/settings/avatar-decoration.dialog.vue
+++ b/packages/frontend/src/pages/settings/avatar-decoration.dialog.vue
@@ -38,7 +38,7 @@ SPDX-License-Identifier: AGPL-3.0-only
{{ i18n.ts.update }}
{{ i18n.ts.detach }}
- {{ i18n.ts.attach }}
+ {{ i18n.ts.attach }}
@@ -61,6 +61,7 @@ const props = defineProps<{
id: string;
url: string;
name: string;
+ roleIdsThatCanBeUsedThisDecoration: string[];
};
}>();
@@ -83,6 +84,7 @@ const emit = defineEmits<{
const dialog = shallowRef