From 499f7b732422fdf8483fe057e5070c48a5315d9d Mon Sep 17 00:00:00 2001 From: samunohito <46447427+samunohito@users.noreply.github.com> Date: Sun, 9 Jun 2024 11:15:14 +0900 Subject: [PATCH] =?UTF-8?q?=E3=83=A9=E3=83=B3=E3=83=80=E3=83=A0=E5=80=A4?= =?UTF-8?q?=E3=81=AB=E3=82=88=E3=82=8BUI=E5=A4=89=E6=9B=B4=E3=81=AE?= =?UTF-8?q?=E6=8A=91=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/frontend/.storybook/fakes.ts | 15 +++++++++------ .../components/MkRoleSelectDialog.stories.impl.ts | 8 ++++---- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/packages/frontend/.storybook/fakes.ts b/packages/frontend/.storybook/fakes.ts index 3f305275ef..c900c77d54 100644 --- a/packages/frontend/.storybook/fakes.ts +++ b/packages/frontend/.storybook/fakes.ts @@ -4,7 +4,7 @@ */ import type { entities } from 'misskey-js' -import { imageDataUrl, text } from "./fake-utils.js"; +import { date, imageDataUrl, text } from "./fake-utils.js"; export function abuseUserReport() { return { @@ -235,6 +235,8 @@ export function role(params: { }, seed?: string): entities.Role { const prefix = params.displayOrder ? params.displayOrder.toString().padStart(3, '0') + '-' : ''; const genId = text(36, seed); + const createdAt = params.createdAt ?? date({}, seed).toISOString(); + const updatedAt = params.updatedAt ?? date({}, seed).toISOString(); return { id: params.id ?? genId, @@ -245,8 +247,8 @@ export function role(params: { isModerator: params.isModerator ?? false, isAdministrator: params.isAdministrator ?? false, displayOrder: params.displayOrder ?? 0, - createdAt: params.createdAt ?? new Date().toISOString(), - updatedAt: params.updatedAt ?? new Date().toISOString(), + createdAt: createdAt, + updatedAt: updatedAt, target: params.target ?? 'manual', isPublic: params.isPublic ?? true, isExplorable: params.isExplorable ?? true, @@ -278,9 +280,10 @@ export function emoji(params?: { roleIdsThatCanBeUsedThisEmojiAsReaction?: {id:string, name:string}[], updatedAt?: string, }, seed?: string): entities.EmojiDetailedAdmin { - const _seed = seed ?? params?.id ?? "DEFAULT_SEED"; - const id = params?.id ?? new Date().getTime().toString() + text(5, _seed); + const _seed = seed ?? (params?.id ?? "DEFAULT_SEED"); + const id = params?.id ?? text(32, _seed); const name = params?.name ?? text(8, _seed); + const updatedAt = params?.updatedAt ?? date({}, _seed).toISOString(); const image = imageDataUrl({}, _seed) @@ -298,6 +301,6 @@ export function emoji(params?: { isSensitive: params?.isSensitive ?? false, localOnly: params?.localOnly ?? false, roleIdsThatCanBeUsedThisEmojiAsReaction: params?.roleIdsThatCanBeUsedThisEmojiAsReaction ?? [], - updatedAt: params?.updatedAt ?? new Date().toISOString(), + updatedAt: updatedAt, } } diff --git a/packages/frontend/src/components/MkRoleSelectDialog.stories.impl.ts b/packages/frontend/src/components/MkRoleSelectDialog.stories.impl.ts index f193233285..411d62edf9 100644 --- a/packages/frontend/src/components/MkRoleSelectDialog.stories.impl.ts +++ b/packages/frontend/src/components/MkRoleSelectDialog.stories.impl.ts @@ -11,10 +11,10 @@ import { commonHandlers } from '../../.storybook/mocks.js'; import MkRoleSelectDialog from '@/components/MkRoleSelectDialog.vue'; const roles = [ - role({ displayOrder: 1 }), role({ displayOrder: 1 }), role({ displayOrder: 1 }), role({ displayOrder: 1 }), - role({ displayOrder: 2 }), role({ displayOrder: 2 }), role({ displayOrder: 3 }), role({ displayOrder: 3 }), - role({ displayOrder: 4 }), role({ displayOrder: 5 }), role({ displayOrder: 6 }), role({ displayOrder: 7 }), - role({ displayOrder: 999, name: 'privateRole', isPublic: false }), + role({ displayOrder: 1 }, '1'), role({ displayOrder: 1 }, '1'), role({ displayOrder: 1 }, '1'), role({ displayOrder: 1 }, '1'), + role({ displayOrder: 2 }, '2'), role({ displayOrder: 2 }, '2'), role({ displayOrder: 3 }, '3'), role({ displayOrder: 3 }, '3'), + role({ displayOrder: 4 }, '4'), role({ displayOrder: 5 }, '5'), role({ displayOrder: 6 }, '6'), role({ displayOrder: 7 }, '7'), + role({ displayOrder: 999, name: 'privateRole', isPublic: false }, '999'), ]; export const Default = {