Merge remote-tracking branch 'misskey-dev/develop' into io
This commit is contained in:
commit
1a243d8ae8
53 changed files with 2071 additions and 2004 deletions
|
@ -4,7 +4,10 @@
|
|||
*/
|
||||
|
||||
/* eslint-disable @typescript-eslint/explicit-function-return-type */
|
||||
import { action } from '@storybook/addon-actions';
|
||||
import { StoryObj } from '@storybook/vue3';
|
||||
import { HttpResponse, http } from 'msw';
|
||||
import { commonHandlers } from '../../.storybook/mocks.js';
|
||||
import { userDetailed } from '../../.storybook/fakes.js';
|
||||
import MkAccountMoved from './MkAccountMoved.vue';
|
||||
export const Default = {
|
||||
|
@ -29,10 +32,18 @@ export const Default = {
|
|||
};
|
||||
},
|
||||
args: {
|
||||
username: userDetailed().username,
|
||||
host: userDetailed().host,
|
||||
movedTo: userDetailed().id,
|
||||
},
|
||||
parameters: {
|
||||
layout: 'centered',
|
||||
msw: {
|
||||
handlers: [
|
||||
...commonHandlers,
|
||||
http.post('/api/users/show', async ({ request }) => {
|
||||
action('POST /api/users/show')(await request.json());
|
||||
return HttpResponse.json(userDetailed());
|
||||
}),
|
||||
],
|
||||
},
|
||||
},
|
||||
} satisfies StoryObj<typeof MkAccountMoved>;
|
||||
|
|
|
@ -4,7 +4,10 @@
|
|||
*/
|
||||
|
||||
/* eslint-disable @typescript-eslint/explicit-function-return-type */
|
||||
import { action } from '@storybook/addon-actions';
|
||||
import { StoryObj } from '@storybook/vue3';
|
||||
import { HttpResponse, http } from 'msw';
|
||||
import { commonHandlers } from '../../.storybook/mocks.js';
|
||||
import MkAnnouncementDialog from './MkAnnouncementDialog.vue';
|
||||
export const Default = {
|
||||
render(args) {
|
||||
|
@ -23,8 +26,13 @@ export const Default = {
|
|||
...this.args,
|
||||
};
|
||||
},
|
||||
events() {
|
||||
return {
|
||||
closed: action('closed'),
|
||||
};
|
||||
},
|
||||
},
|
||||
template: '<MkAnnouncementDialog v-bind="props" />',
|
||||
template: '<MkAnnouncementDialog v-bind="props" v-on="events" />',
|
||||
};
|
||||
},
|
||||
args: {
|
||||
|
@ -38,10 +46,20 @@ export const Default = {
|
|||
imageUrl: null,
|
||||
display: 'dialog',
|
||||
needConfirmationToRead: false,
|
||||
silence: false,
|
||||
forYou: true,
|
||||
},
|
||||
},
|
||||
parameters: {
|
||||
layout: 'centered',
|
||||
msw: {
|
||||
handlers: [
|
||||
...commonHandlers,
|
||||
http.post('/api/i/read-announcement', async ({ request }) => {
|
||||
action('POST /api/i/read-announcement')(await request.json());
|
||||
return HttpResponse.json();
|
||||
}),
|
||||
],
|
||||
},
|
||||
},
|
||||
} satisfies StoryObj<typeof MkAnnouncementDialog>;
|
||||
|
|
|
@ -4,19 +4,11 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
-->
|
||||
|
||||
<template>
|
||||
<div v-if="meta" :class="$style.root" :style="{ backgroundImage: `url(${ meta.backgroundImageUrl })` }"></div>
|
||||
<div v-if="instance" :class="$style.root" :style="{ backgroundImage: `url(${ instance.backgroundImageUrl })` }"></div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref } from 'vue';
|
||||
import * as Misskey from 'misskey-js';
|
||||
import { misskeyApi } from '@/scripts/misskey-api.js';
|
||||
|
||||
const meta = ref<Misskey.entities.MetaResponse>();
|
||||
|
||||
misskeyApi('meta', { detail: true }).then(gotMeta => {
|
||||
meta.value = gotMeta;
|
||||
});
|
||||
import { instance } from '@/instance.js';
|
||||
</script>
|
||||
|
||||
<style lang="scss" module>
|
||||
|
|
|
@ -157,6 +157,7 @@ const props = withDefaults(defineProps<{
|
|||
initialVisibleUsers: () => [],
|
||||
autofocus: true,
|
||||
mock: false,
|
||||
initialLocalOnly: undefined,
|
||||
});
|
||||
|
||||
provide('mock', props.mock);
|
||||
|
@ -188,8 +189,8 @@ watch(showPreview, () => defaultStore.set('showPreview', showPreview.value));
|
|||
const showAddMfmFunction = ref(defaultStore.state.enableQuickAddMfmFunction);
|
||||
watch(showAddMfmFunction, () => defaultStore.set('enableQuickAddMfmFunction', showAddMfmFunction.value));
|
||||
const cw = ref<string | null>(props.initialCw ?? null);
|
||||
const localOnly = ref<boolean>(props.initialLocalOnly ?? defaultStore.state.rememberNoteVisibility ? defaultStore.state.localOnly : defaultStore.state.defaultNoteLocalOnly);
|
||||
const visibility = ref(props.initialVisibility ?? (defaultStore.state.rememberNoteVisibility ? defaultStore.state.visibility : defaultStore.state.defaultNoteVisibility) as typeof Misskey.noteVisibilities[number]);
|
||||
const localOnly = ref(props.initialLocalOnly ?? (defaultStore.state.rememberNoteVisibility ? defaultStore.state.localOnly : defaultStore.state.defaultNoteLocalOnly));
|
||||
const visibility = ref(props.initialVisibility ?? (defaultStore.state.rememberNoteVisibility ? defaultStore.state.visibility : defaultStore.state.defaultNoteVisibility));
|
||||
const visibleUsers = ref<Misskey.entities.UserDetailed[]>([]);
|
||||
if (props.initialVisibleUsers) {
|
||||
props.initialVisibleUsers.forEach(pushVisibleUser);
|
||||
|
@ -526,6 +527,9 @@ async function toggleLocalOnly() {
|
|||
}
|
||||
|
||||
localOnly.value = !localOnly.value;
|
||||
if (defaultStore.state.rememberNoteVisibility) {
|
||||
defaultStore.set('localOnly', localOnly.value);
|
||||
}
|
||||
}
|
||||
|
||||
async function toggleReactionAcceptance() {
|
||||
|
|
|
@ -16,7 +16,7 @@ import MkModal from '@/components/MkModal.vue';
|
|||
import MkPostForm from '@/components/MkPostForm.vue';
|
||||
import * as os from '@/os.js';
|
||||
|
||||
const props = defineProps<{
|
||||
const props = withDefaults(defineProps<{
|
||||
reply?: Misskey.entities.Note;
|
||||
renote?: Misskey.entities.Note;
|
||||
channel?: any; // TODO
|
||||
|
@ -32,7 +32,9 @@ const props = defineProps<{
|
|||
instant?: boolean;
|
||||
fixed?: boolean;
|
||||
autofocus?: boolean;
|
||||
}>();
|
||||
}>(), {
|
||||
initialLocalOnly: undefined,
|
||||
});
|
||||
|
||||
const emit = defineEmits<{
|
||||
(ev: 'closed'): void;
|
||||
|
|
|
@ -51,13 +51,16 @@ export const Empty = {
|
|||
expect(buttons.at(-1)).toBeEnabled();
|
||||
},
|
||||
args: {
|
||||
// @ts-expect-error serverRules is for test
|
||||
serverRules: [],
|
||||
tosUrl: null,
|
||||
},
|
||||
decorators: [
|
||||
(_, context) => ({
|
||||
setup() {
|
||||
// @ts-expect-error serverRules is for test
|
||||
instance.serverRules = context.args.serverRules;
|
||||
// @ts-expect-error tosUrl is for test
|
||||
instance.tosUrl = context.args.tosUrl;
|
||||
onBeforeUnmount(() => {
|
||||
// FIXME: 呼び出されない
|
||||
|
@ -76,6 +79,7 @@ export const ServerRulesOnly = {
|
|||
...Empty,
|
||||
args: {
|
||||
...Empty.args,
|
||||
// @ts-expect-error serverRules is for test
|
||||
serverRules: [
|
||||
'ルール',
|
||||
],
|
||||
|
@ -85,6 +89,7 @@ export const TOSOnly = {
|
|||
...Empty,
|
||||
args: {
|
||||
...Empty.args,
|
||||
// @ts-expect-error tosUrl is for test
|
||||
tosUrl: 'https://example.com/tos',
|
||||
},
|
||||
} satisfies StoryObj<typeof MkSignupServerRules>;
|
||||
|
@ -92,6 +97,7 @@ export const ServerRulesAndTOS = {
|
|||
...Empty,
|
||||
args: {
|
||||
...Empty.args,
|
||||
// @ts-expect-error serverRules is for test
|
||||
serverRules: ServerRulesOnly.args.serverRules,
|
||||
tosUrl: TOSOnly.args.tosUrl,
|
||||
},
|
||||
|
|
|
@ -4,19 +4,19 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
-->
|
||||
|
||||
<template>
|
||||
<div v-if="meta" :class="$style.root">
|
||||
<div v-if="instance" :class="$style.root">
|
||||
<div :class="[$style.main, $style.panel]">
|
||||
<img :src="instance.iconUrl || '/favicon.ico'" alt="" :class="$style.mainIcon"/>
|
||||
<button class="_button _acrylic" :class="$style.mainMenu" @click="showMenu"><i class="ti ti-dots"></i></button>
|
||||
<div :class="$style.mainFg">
|
||||
<h1 :class="$style.mainTitle">
|
||||
<!-- 背景色によってはロゴが見えなくなるのでとりあえず無効に -->
|
||||
<!-- <img class="logo" v-if="meta.logoImageUrl" :src="meta.logoImageUrl"><span v-else class="text">{{ instanceName }}</span> -->
|
||||
<!-- <img class="logo" v-if="instance.logoImageUrl" :src="instance.logoImageUrl"><span v-else class="text">{{ instanceName }}</span> -->
|
||||
<span>{{ instanceName }}</span>
|
||||
</h1>
|
||||
<div :class="$style.mainAbout">
|
||||
<!-- eslint-disable-next-line vue/no-v-html -->
|
||||
<div v-html="meta.description || i18n.ts.headlineMisskey"></div>
|
||||
<div v-html="instance.description || i18n.ts.headlineMisskey"></div>
|
||||
</div>
|
||||
<div v-if="instance.disableRegistration" :class="$style.mainWarn">
|
||||
<MkInfo warn>{{ i18n.ts.invitationRequiredToRegister }}</MkInfo>
|
||||
|
@ -83,14 +83,10 @@ import { i18n } from '@/i18n.js';
|
|||
import { instance } from '@/instance.js';
|
||||
import MkNumber from '@/components/MkNumber.vue';
|
||||
import XActiveUsersChart from '@/components/MkVisitorDashboard.ActiveUsersChart.vue';
|
||||
import { openInstanceMenu } from '@/ui/_common_/common';
|
||||
|
||||
const meta = ref<Misskey.entities.MetaResponse | null>(null);
|
||||
const stats = ref<Misskey.entities.StatsResponse | null>(null);
|
||||
|
||||
misskeyApi('meta', { detail: true }).then(_meta => {
|
||||
meta.value = _meta;
|
||||
});
|
||||
|
||||
misskeyApi('stats', {}).then((res) => {
|
||||
stats.value = res;
|
||||
});
|
||||
|
@ -108,43 +104,7 @@ function signup() {
|
|||
}
|
||||
|
||||
function showMenu(ev) {
|
||||
os.popupMenu([{
|
||||
text: i18n.ts.instanceInfo,
|
||||
icon: 'ti ti-info-circle',
|
||||
action: () => {
|
||||
os.pageWindow('/about');
|
||||
},
|
||||
}, {
|
||||
text: i18n.ts.aboutMisskey,
|
||||
icon: 'ti ti-info-circle',
|
||||
action: () => {
|
||||
os.pageWindow('/about-misskey');
|
||||
},
|
||||
}, { type: 'divider' }, (instance.impressumUrl) ? {
|
||||
text: i18n.ts.impressum,
|
||||
icon: 'ti ti-file-invoice',
|
||||
action: () => {
|
||||
window.open(instance.impressumUrl!, '_blank', 'noopener');
|
||||
},
|
||||
} : undefined, (instance.tosUrl) ? {
|
||||
text: i18n.ts.termsOfService,
|
||||
icon: 'ti ti-notebook',
|
||||
action: () => {
|
||||
window.open(instance.tosUrl!, '_blank', 'noopener');
|
||||
},
|
||||
} : undefined, (instance.privacyPolicyUrl) ? {
|
||||
text: i18n.ts.privacyPolicy,
|
||||
icon: 'ti ti-shield-lock',
|
||||
action: () => {
|
||||
window.open(instance.privacyPolicyUrl!, '_blank', 'noopener');
|
||||
},
|
||||
} : undefined, (!instance.impressumUrl && !instance.tosUrl && !instance.privacyPolicyUrl) ? undefined : { type: 'divider' }, {
|
||||
text: i18n.ts.help,
|
||||
icon: 'ti ti-help-circle',
|
||||
action: () => {
|
||||
window.open('https://misskey-hub.net/docs/for-users/', '_blank', 'noopener');
|
||||
},
|
||||
}], ev.currentTarget ?? ev.target);
|
||||
openInstanceMenu(ev);
|
||||
}
|
||||
|
||||
function exploreOtherServers() {
|
||||
|
|
|
@ -4,8 +4,10 @@
|
|||
*/
|
||||
|
||||
/* eslint-disable @typescript-eslint/explicit-function-return-type */
|
||||
import { expect, userEvent, waitFor, within } from '@storybook/test';
|
||||
import { StoryObj } from '@storybook/vue3';
|
||||
import MkAd from './MkAd.vue';
|
||||
import { i18n } from '@/i18n.js';
|
||||
|
||||
let lock: Promise<undefined> | undefined;
|
||||
|
||||
|
@ -30,7 +32,6 @@ const common = {
|
|||
template: '<MkAd v-bind="props" />',
|
||||
};
|
||||
},
|
||||
/* FIXME: disabled because it still didn’t pass after applying #11267
|
||||
async play({ canvasElement, args }) {
|
||||
if (lock) {
|
||||
console.warn('This test is unexpectedly running twice in parallel, fix it!');
|
||||
|
@ -44,7 +45,7 @@ const common = {
|
|||
try {
|
||||
const canvas = within(canvasElement);
|
||||
const a = canvas.getByRole<HTMLAnchorElement>('link');
|
||||
await expect(a.href).toMatch(/^https?:\/\/.*#test$/);
|
||||
// await expect(a.href).toMatch(/^https?:\/\/.*#test$/);
|
||||
const img = within(a).getByRole('img');
|
||||
await expect(img).toBeInTheDocument();
|
||||
let buttons = canvas.getAllByRole<HTMLButtonElement>('button');
|
||||
|
@ -52,13 +53,14 @@ const common = {
|
|||
const i = buttons[0];
|
||||
await expect(i).toBeInTheDocument();
|
||||
await userEvent.click(i);
|
||||
await waitFor(() => expect(canvasElement).toHaveTextContent(i18n.ts._ad.back));
|
||||
// await expect(canvasElement).toHaveTextContent(i18n.ts._ad.back);
|
||||
await expect(a).not.toBeInTheDocument();
|
||||
await expect(i).not.toBeInTheDocument();
|
||||
buttons = canvas.getAllByRole<HTMLButtonElement>('button');
|
||||
await expect(buttons).toHaveLength(args.__hasReduce ? 2 : 1);
|
||||
const reduce = args.__hasReduce ? buttons[0] : null;
|
||||
const back = buttons[args.__hasReduce ? 1 : 0];
|
||||
const hasReduceFrequency = args.specify?.ratio !== 0;
|
||||
await expect(buttons).toHaveLength(hasReduceFrequency ? 2 : 1);
|
||||
const reduce = hasReduceFrequency ? buttons[0] : null;
|
||||
const back = buttons[hasReduceFrequency ? 1 : 0];
|
||||
if (reduce) {
|
||||
await expect(reduce).toBeInTheDocument();
|
||||
await expect(reduce).toHaveTextContent(i18n.ts._ad.reduceFrequencyOfThisAd);
|
||||
|
@ -80,15 +82,16 @@ const common = {
|
|||
lock = undefined;
|
||||
}
|
||||
},
|
||||
*/
|
||||
args: {
|
||||
prefer: [],
|
||||
specify: {
|
||||
id: 'someadid',
|
||||
radio: 1,
|
||||
ratio: 1,
|
||||
url: '#test',
|
||||
place: '',
|
||||
imageUrl: '',
|
||||
dayOfWeek: 7,
|
||||
},
|
||||
__hasReduce: true,
|
||||
},
|
||||
parameters: {
|
||||
layout: 'centered',
|
||||
|
@ -138,6 +141,5 @@ export const ZeroRatio = {
|
|||
...Square.args.specify,
|
||||
ratio: 0,
|
||||
},
|
||||
__hasReduce: false,
|
||||
},
|
||||
} satisfies StoryObj<typeof MkAd>;
|
||||
|
|
|
@ -33,7 +33,7 @@ const common = {
|
|||
},
|
||||
decorators: [
|
||||
(Story, context) => ({
|
||||
// eslint-disable-next-line quotes
|
||||
// @ts-expect-error size is for test
|
||||
template: `<div :style="{ display: 'grid', width: '${context.args.size}px', height: '${context.args.size}px' }"><story/></div>`,
|
||||
}),
|
||||
],
|
||||
|
@ -45,6 +45,7 @@ export const ProfilePage = {
|
|||
...common,
|
||||
args: {
|
||||
...common.args,
|
||||
// @ts-expect-error size is for test
|
||||
size: 120,
|
||||
indicator: true,
|
||||
},
|
||||
|
|
|
@ -28,6 +28,7 @@ export const Default = {
|
|||
};
|
||||
},
|
||||
args: {
|
||||
// @ts-expect-error text is for test
|
||||
text: 'This is a condensed line.',
|
||||
},
|
||||
parameters: {
|
||||
|
@ -41,4 +42,5 @@ export const ContainerIs100px = {
|
|||
template: '<div style="width: 100px;"><story/></div>',
|
||||
}),
|
||||
],
|
||||
// @ts-expect-error text is for test
|
||||
} satisfies StoryObj<typeof MkCondensedLine>;
|
||||
|
|
|
@ -3,8 +3,11 @@
|
|||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { Meta } from '@storybook/vue3';
|
||||
import MkError from './MkError.vue';
|
||||
|
||||
export const argTypes = {
|
||||
retry: {
|
||||
onRetry: {
|
||||
action: 'retry',
|
||||
},
|
||||
};
|
||||
} satisfies Meta<typeof MkError>['argTypes'];
|
||||
|
|
|
@ -33,7 +33,6 @@ export const Empty = {
|
|||
await waitFor(async () => await wait);
|
||||
},
|
||||
args: {
|
||||
static: true,
|
||||
tabs: [],
|
||||
},
|
||||
parameters: {
|
||||
|
@ -71,8 +70,8 @@ export const IconOnly = {
|
|||
...Icon.args,
|
||||
tabs: [
|
||||
{
|
||||
...Icon.args.tabs[0],
|
||||
title: undefined,
|
||||
key: Icon.args.tabs[0].key,
|
||||
icon: Icon.args.tabs[0].icon,
|
||||
iconOnly: true,
|
||||
},
|
||||
],
|
||||
|
|
|
@ -38,7 +38,6 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
<script lang="ts">
|
||||
export type Tab = {
|
||||
key: string;
|
||||
title: string;
|
||||
onClick?: (ev: MouseEvent) => void;
|
||||
} & (
|
||||
| {
|
||||
|
|
|
@ -60,7 +60,7 @@ export const RelativeFuture = {
|
|||
export const AbsoluteFuture = {
|
||||
...Empty,
|
||||
async play({ canvasElement, args }) {
|
||||
await expect(canvasElement).toHaveTextContent(dateTimeFormat.format(args.time));
|
||||
await expect(canvasElement).toHaveTextContent(dateTimeFormat.format(typeof args.time === 'string' ? new Date(args.time) : args.time ?? undefined));
|
||||
},
|
||||
args: {
|
||||
...Empty.args,
|
||||
|
@ -97,7 +97,7 @@ export const RelativeNow = {
|
|||
export const AbsoluteNow = {
|
||||
...Empty,
|
||||
async play({ canvasElement, args }) {
|
||||
await expect(canvasElement).toHaveTextContent(dateTimeFormat.format(args.time));
|
||||
await expect(canvasElement).toHaveTextContent(dateTimeFormat.format(typeof args.time === 'string' ? new Date(args.time) : args.time ?? undefined));
|
||||
},
|
||||
args: {
|
||||
...Empty.args,
|
||||
|
@ -136,7 +136,7 @@ export const RelativeOneHourAgo = {
|
|||
export const AbsoluteOneHourAgo = {
|
||||
...Empty,
|
||||
async play({ canvasElement, args }) {
|
||||
await expect(canvasElement).toHaveTextContent(dateTimeFormat.format(args.time));
|
||||
await expect(canvasElement).toHaveTextContent(dateTimeFormat.format(typeof args.time === 'string' ? new Date(args.time) : args.time ?? undefined));
|
||||
},
|
||||
args: {
|
||||
...Empty.args,
|
||||
|
@ -175,7 +175,7 @@ export const RelativeOneDayAgo = {
|
|||
export const AbsoluteOneDayAgo = {
|
||||
...Empty,
|
||||
async play({ canvasElement, args }) {
|
||||
await expect(canvasElement).toHaveTextContent(dateTimeFormat.format(args.time));
|
||||
await expect(canvasElement).toHaveTextContent(dateTimeFormat.format(typeof args.time === 'string' ? new Date(args.time) : args.time ?? undefined));
|
||||
},
|
||||
args: {
|
||||
...Empty.args,
|
||||
|
@ -214,7 +214,7 @@ export const RelativeOneWeekAgo = {
|
|||
export const AbsoluteOneWeekAgo = {
|
||||
...Empty,
|
||||
async play({ canvasElement, args }) {
|
||||
await expect(canvasElement).toHaveTextContent(dateTimeFormat.format(args.time));
|
||||
await expect(canvasElement).toHaveTextContent(dateTimeFormat.format(typeof args.time === 'string' ? new Date(args.time) : args.time ?? undefined));
|
||||
},
|
||||
args: {
|
||||
...Empty.args,
|
||||
|
@ -253,7 +253,7 @@ export const RelativeOneMonthAgo = {
|
|||
export const AbsoluteOneMonthAgo = {
|
||||
...Empty,
|
||||
async play({ canvasElement, args }) {
|
||||
await expect(canvasElement).toHaveTextContent(dateTimeFormat.format(args.time));
|
||||
await expect(canvasElement).toHaveTextContent(dateTimeFormat.format(typeof args.time === 'string' ? new Date(args.time) : args.time ?? undefined));
|
||||
},
|
||||
args: {
|
||||
...Empty.args,
|
||||
|
@ -292,7 +292,7 @@ export const RelativeOneYearAgo = {
|
|||
export const AbsoluteOneYearAgo = {
|
||||
...Empty,
|
||||
async play({ canvasElement, args }) {
|
||||
await expect(canvasElement).toHaveTextContent(dateTimeFormat.format(args.time));
|
||||
await expect(canvasElement).toHaveTextContent(dateTimeFormat.format(typeof args.time === 'string' ? new Date(args.time) : args.time ?? undefined));
|
||||
},
|
||||
args: {
|
||||
...Empty.args,
|
||||
|
|
|
@ -30,7 +30,7 @@ export const Default = {
|
|||
};
|
||||
},
|
||||
async play({ canvasElement }) {
|
||||
await expect(canvasElement).toHaveTextContent(userDetailed().name);
|
||||
await expect(canvasElement).toHaveTextContent(userDetailed().name as string);
|
||||
},
|
||||
args: {
|
||||
user: userDetailed(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue