diff options
| author | syuilo <Syuilotan@yahoo.co.jp> | 2023-09-29 18:11:30 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-09-29 18:11:30 +0900 |
| commit | 7adc8fcaf5e7a57edfd2c197fcccb510425bd82c (patch) | |
| tree | e60179e48010b0a389f87687e934f71ead92b27f /packages/frontend/src/components | |
| parent | Merge pull request #11898 from misskey-dev/develop (diff) | |
| parent | fix (diff) | |
| download | misskey-7adc8fcaf5e7a57edfd2c197fcccb510425bd82c.tar.gz misskey-7adc8fcaf5e7a57edfd2c197fcccb510425bd82c.tar.bz2 misskey-7adc8fcaf5e7a57edfd2c197fcccb510425bd82c.zip | |
Merge pull request #11920 from misskey-dev/develop
Release: 2023.9.2
Diffstat (limited to 'packages/frontend/src/components')
10 files changed, 135 insertions, 116 deletions
diff --git a/packages/frontend/src/components/MkNoteDetailed.vue b/packages/frontend/src/components/MkNoteDetailed.vue index 06663d0477..ab8886e8ba 100644 --- a/packages/frontend/src/components/MkNoteDetailed.vue +++ b/packages/frontend/src/components/MkNoteDetailed.vue @@ -93,6 +93,9 @@ SPDX-License-Identifier: AGPL-3.0-only </div> <footer> <div :class="$style.noteFooterInfo"> + <div v-if="appearNote.updatedAt"> + {{ i18n.ts.edited }}: <MkTime :time="appearNote.updatedAt" mode="detail"/> + </div> <MkA :to="notePage(appearNote)"> <MkTime :time="appearNote.createdAt" mode="detail"/> </MkA> diff --git a/packages/frontend/src/components/MkNoteHeader.vue b/packages/frontend/src/components/MkNoteHeader.vue index dda7238d27..05f98c638e 100644 --- a/packages/frontend/src/components/MkNoteHeader.vue +++ b/packages/frontend/src/components/MkNoteHeader.vue @@ -14,6 +14,7 @@ SPDX-License-Identifier: AGPL-3.0-only <img v-for="role in note.user.badgeRoles" :key="role.id" v-tooltip="role.name" :class="$style.badgeRole" :src="role.iconUrl"/> </div> <div :class="$style.info"> + <span v-if="note.updatedAt" style="margin-right: 0.5em;" :title="i18n.ts.edited"><i class="ti ti-pencil"></i></span> <MkA :to="notePage(note)"> <MkTime :time="note.createdAt"/> </MkA> diff --git a/packages/frontend/src/components/MkNotificationSelectWindow.vue b/packages/frontend/src/components/MkNotificationSelectWindow.vue new file mode 100644 index 0000000000..3d5a56975b --- /dev/null +++ b/packages/frontend/src/components/MkNotificationSelectWindow.vue @@ -0,0 +1,78 @@ +<!-- +SPDX-FileCopyrightText: syuilo and other misskey contributors +SPDX-License-Identifier: AGPL-3.0-only +--> + +<template> +<MkModalWindow + ref="dialog" + :width="400" + :height="450" + :withOkButton="true" + :okButtonDisabled="false" + @ok="ok()" + @close="dialog?.close()" + @closed="emit('closed')" +> + <template #header>{{ i18n.ts.notificationSetting }}</template> + + <MkSpacer :marginMin="20" :marginMax="28"> + <div class="_gaps_m"> + <MkInfo>{{ i18n.ts.notificationSettingDesc }}</MkInfo> + <div class="_buttons"> + <MkButton inline @click="disableAll">{{ i18n.ts.disableAll }}</MkButton> + <MkButton inline @click="enableAll">{{ i18n.ts.enableAll }}</MkButton> + </div> + <MkSwitch v-for="ntype in notificationTypes" :key="ntype" v-model="typesMap[ntype].value">{{ i18n.t(`_notification._types.${ntype}`) }}</MkSwitch> + </div> + </MkSpacer> +</MkModalWindow> +</template> + +<script lang="ts" setup> +import { ref, Ref } from 'vue'; +import MkSwitch from './MkSwitch.vue'; +import MkInfo from './MkInfo.vue'; +import MkButton from './MkButton.vue'; +import MkModalWindow from '@/components/MkModalWindow.vue'; +import { notificationTypes } from '@/const.js'; +import { i18n } from '@/i18n.js'; + +type TypesMap = Record<typeof notificationTypes[number], Ref<boolean>> + +const emit = defineEmits<{ + (ev: 'done', v: { excludeTypes: string[] }): void, + (ev: 'closed'): void, +}>(); + +const props = withDefaults(defineProps<{ + excludeTypes?: typeof notificationTypes[number][]; +}>(), { + excludeTypes: () => [], +}); + +const dialog = $shallowRef<InstanceType<typeof MkModalWindow>>(); + +const typesMap: TypesMap = notificationTypes.reduce((p, t) => ({ ...p, [t]: ref<boolean>(!props.excludeTypes.includes(t)) }), {} as any); + +function ok() { + emit('done', { + excludeTypes: (Object.keys(typesMap) as typeof notificationTypes[number][]) + .filter(type => !typesMap[type].value), + }); + + if (dialog) dialog.close(); +} + +function disableAll() { + for (const type of notificationTypes) { + typesMap[type].value = false; + } +} + +function enableAll() { + for (const type of notificationTypes) { + typesMap[type].value = true; + } +} +</script> diff --git a/packages/frontend/src/components/MkNotificationSettingWindow.vue b/packages/frontend/src/components/MkNotificationSettingWindow.vue deleted file mode 100644 index a25914b214..0000000000 --- a/packages/frontend/src/components/MkNotificationSettingWindow.vue +++ /dev/null @@ -1,95 +0,0 @@ -<!-- -SPDX-FileCopyrightText: syuilo and other misskey contributors -SPDX-License-Identifier: AGPL-3.0-only ---> - -<template> -<MkModalWindow - ref="dialog" - :width="400" - :height="450" - :withOkButton="true" - :okButtonDisabled="false" - @ok="ok()" - @close="dialog?.close()" - @closed="emit('closed')" -> - <template #header>{{ i18n.ts.notificationSetting }}</template> - - <MkSpacer :marginMin="20" :marginMax="28"> - <div class="_gaps_m"> - <template v-if="showGlobalToggle"> - <MkSwitch v-model="useGlobalSetting"> - {{ i18n.ts.useGlobalSetting }} - <template #caption>{{ i18n.ts.useGlobalSettingDesc }}</template> - </MkSwitch> - </template> - <template v-if="!useGlobalSetting"> - <MkInfo>{{ i18n.ts.notificationSettingDesc }}</MkInfo> - <div class="_buttons"> - <MkButton inline @click="disableAll">{{ i18n.ts.disableAll }}</MkButton> - <MkButton inline @click="enableAll">{{ i18n.ts.enableAll }}</MkButton> - </div> - <MkSwitch v-for="ntype in notificationTypes" :key="ntype" v-model="typesMap[ntype].value">{{ i18n.t(`_notification._types.${ntype}`) }}</MkSwitch> - </template> - </div> - </MkSpacer> -</MkModalWindow> -</template> - -<script lang="ts" setup> -import { ref, Ref } from 'vue'; -import MkSwitch from './MkSwitch.vue'; -import MkInfo from './MkInfo.vue'; -import MkButton from './MkButton.vue'; -import MkModalWindow from '@/components/MkModalWindow.vue'; -import { notificationTypes } from '@/const'; -import { i18n } from '@/i18n.js'; - -type TypesMap = Record<typeof notificationTypes[number], Ref<boolean>> - -const emit = defineEmits<{ - (ev: 'done', v: { includingTypes: string[] | null }): void, - (ev: 'closed'): void, -}>(); - -const props = withDefaults(defineProps<{ - includingTypes?: typeof notificationTypes[number][] | null; - showGlobalToggle?: boolean; -}>(), { - includingTypes: () => [], - showGlobalToggle: true, -}); - -let includingTypes = $computed(() => props.includingTypes?.filter(x => notificationTypes.includes(x)) ?? []); - -const dialog = $shallowRef<InstanceType<typeof MkModalWindow>>(); - -const typesMap: TypesMap = notificationTypes.reduce((p, t) => ({ ...p, [t]: ref<boolean>(includingTypes.includes(t)) }), {} as any); -let useGlobalSetting = $ref((includingTypes === null || includingTypes.length === 0) && props.showGlobalToggle); - -function ok() { - if (useGlobalSetting) { - emit('done', { includingTypes: null }); - } else { - emit('done', { - includingTypes: (Object.keys(typesMap) as typeof notificationTypes[number][]) - .filter(type => typesMap[type].value), - }); - } - - if (dialog) dialog.close(); -} - -function disableAll() { - for (const type of notificationTypes) { - typesMap[type].value = false; - } -} - -function enableAll() { - for (const type of notificationTypes) { - typesMap[type].value = true; - } -} -</script> diff --git a/packages/frontend/src/components/MkNotifications.vue b/packages/frontend/src/components/MkNotifications.vue index ad1cb92ce1..6ba2e513c5 100644 --- a/packages/frontend/src/components/MkNotifications.vue +++ b/packages/frontend/src/components/MkNotifications.vue @@ -30,11 +30,11 @@ import MkNote from '@/components/MkNote.vue'; import { useStream } from '@/stream.js'; import { $i } from '@/account.js'; import { i18n } from '@/i18n.js'; -import { notificationTypes } from '@/const'; +import { notificationTypes } from '@/const.js'; import { infoImageUrl } from '@/instance.js'; const props = defineProps<{ - includeTypes?: typeof notificationTypes[number][]; + excludeTypes?: typeof notificationTypes[number][]; }>(); const pagingComponent = shallowRef<InstanceType<typeof MkPagination>>(); @@ -43,13 +43,12 @@ const pagination: Paging = { endpoint: 'i/notifications' as const, limit: 10, params: computed(() => ({ - includeTypes: props.includeTypes ?? undefined, - excludeTypes: props.includeTypes ? undefined : $i.mutingNotificationTypes, + excludeTypes: props.excludeTypes ?? undefined, })), }; const onNotification = (notification) => { - const isMuted = props.includeTypes ? !props.includeTypes.includes(notification.type) : $i.mutingNotificationTypes.includes(notification.type); + const isMuted = props.excludeTypes ? props.excludeTypes.includes(notification.type) : false; if (isMuted || document.visibilityState === 'visible') { useStream().send('readNotification'); } diff --git a/packages/frontend/src/components/MkPostForm.vue b/packages/frontend/src/components/MkPostForm.vue index 2b4dcc8ed4..b82ca3ef19 100644 --- a/packages/frontend/src/components/MkPostForm.vue +++ b/packages/frontend/src/components/MkPostForm.vue @@ -143,6 +143,7 @@ const props = withDefaults(defineProps<{ fixed?: boolean; autofocus?: boolean; freezeAfterPosted?: boolean; + updateMode?: boolean; }>(), { initialVisibleUsers: () => [], autofocus: true, @@ -698,17 +699,18 @@ async function post(ev?: MouseEvent) { } let postData = { - text: text === '' ? undefined : text, + text: text === '' ? null : text, fileIds: files.length > 0 ? files.map(f => f.id) : undefined, replyId: props.reply ? props.reply.id : undefined, renoteId: props.renote ? props.renote.id : quoteId ? quoteId : undefined, channelId: props.channel ? props.channel.id : undefined, poll: poll, - cw: useCw ? cw ?? '' : undefined, + cw: useCw ? cw ?? '' : null, localOnly: localOnly, visibility: visibility, visibleUserIds: visibility === 'specified' ? visibleUsers.map(u => u.id) : undefined, reactionAcceptance, + noteId: props.updateMode ? props.initialNote?.id : undefined, }; if (withHashtags && hashtags && hashtags.trim() !== '') { @@ -731,7 +733,7 @@ async function post(ev?: MouseEvent) { } posting = true; - os.api('notes/create', postData, token).then(() => { + os.api(props.updateMode ? 'notes/update' : 'notes/create', postData, token).then(() => { if (props.freezeAfterPosted) { posted = true; } else { @@ -819,8 +821,10 @@ function showActions(ev) { action: () => { action.handler({ text: text, + cw: cw, }, (key, value) => { if (key === 'text') { text = value; } + if (key === 'cw') { useCw = value !== null; cw = value; } }); }, })), ev.currentTarget ?? ev.target); diff --git a/packages/frontend/src/components/MkPostFormDialog.vue b/packages/frontend/src/components/MkPostFormDialog.vue index c07a166a83..f33d498f93 100644 --- a/packages/frontend/src/components/MkPostFormDialog.vue +++ b/packages/frontend/src/components/MkPostFormDialog.vue @@ -30,6 +30,7 @@ const props = defineProps<{ instant?: boolean; fixed?: boolean; autofocus?: boolean; + updateMode?: boolean; }>(); const emit = defineEmits<{ diff --git a/packages/frontend/src/components/MkTimeline.vue b/packages/frontend/src/components/MkTimeline.vue index d6712e7606..1dcafd6be1 100644 --- a/packages/frontend/src/components/MkTimeline.vue +++ b/packages/frontend/src/components/MkTimeline.vue @@ -15,14 +15,21 @@ import * as sound from '@/scripts/sound.js'; import { $i } from '@/account.js'; import { defaultStore } from '@/store.js'; -const props = defineProps<{ +const props = withDefaults(defineProps<{ src: string; list?: string; antenna?: string; channel?: string; role?: string; sound?: boolean; -}>(); + withRenotes?: boolean; + withReplies?: boolean; + onlyFiles?: boolean; +}>(), { + withRenotes: true, + withReplies: false, + onlyFiles: false, +}); const emit = defineEmits<{ (ev: 'note'): void; @@ -62,10 +69,14 @@ if (props.src === 'antenna') { } else if (props.src === 'home') { endpoint = 'notes/timeline'; query = { - withReplies: defaultStore.state.showTimelineReplies, + withRenotes: props.withRenotes, + withReplies: props.withReplies, + withFiles: props.onlyFiles ? true : undefined, }; connection = stream.useChannel('homeTimeline', { - withReplies: defaultStore.state.showTimelineReplies, + withRenotes: props.withRenotes, + withReplies: props.withReplies, + withFiles: props.onlyFiles ? true : undefined, }); connection.on('note', prepend); @@ -73,28 +84,40 @@ if (props.src === 'antenna') { } else if (props.src === 'local') { endpoint = 'notes/local-timeline'; query = { - withReplies: defaultStore.state.showTimelineReplies, + withRenotes: props.withRenotes, + withReplies: props.withReplies, + withFiles: props.onlyFiles ? true : undefined, }; connection = stream.useChannel('localTimeline', { - withReplies: defaultStore.state.showTimelineReplies, + withRenotes: props.withRenotes, + withReplies: props.withReplies, + withFiles: props.onlyFiles ? true : undefined, }); connection.on('note', prepend); } else if (props.src === 'social') { endpoint = 'notes/hybrid-timeline'; query = { - withReplies: defaultStore.state.showTimelineReplies, + withRenotes: props.withRenotes, + withReplies: props.withReplies, + withFiles: props.onlyFiles ? true : undefined, }; connection = stream.useChannel('hybridTimeline', { - withReplies: defaultStore.state.showTimelineReplies, + withRenotes: props.withRenotes, + withReplies: props.withReplies, + withFiles: props.onlyFiles ? true : undefined, }); connection.on('note', prepend); } else if (props.src === 'global') { endpoint = 'notes/global-timeline'; query = { - withReplies: defaultStore.state.showTimelineReplies, + withRenotes: props.withRenotes, + withReplies: props.withReplies, + withFiles: props.onlyFiles ? true : undefined, }; connection = stream.useChannel('globalTimeline', { - withReplies: defaultStore.state.showTimelineReplies, + withRenotes: props.withRenotes, + withReplies: props.withReplies, + withFiles: props.onlyFiles ? true : undefined, }); connection.on('note', prepend); } else if (props.src === 'mentions') { @@ -116,9 +139,15 @@ if (props.src === 'antenna') { } else if (props.src === 'list') { endpoint = 'notes/user-list-timeline'; query = { + withRenotes: props.withRenotes, + withReplies: props.withReplies, + withFiles: props.onlyFiles ? true : undefined, listId: props.list, }; connection = stream.useChannel('userList', { + withRenotes: props.withRenotes, + withReplies: props.withReplies, + withFiles: props.onlyFiles ? true : undefined, listId: props.list, }); connection.on('note', prepend); diff --git a/packages/frontend/src/components/MkVisitorDashboard.vue b/packages/frontend/src/components/MkVisitorDashboard.vue index 7a8d7e6109..e4520bbb2d 100644 --- a/packages/frontend/src/components/MkVisitorDashboard.vue +++ b/packages/frontend/src/components/MkVisitorDashboard.vue @@ -114,8 +114,7 @@ function showMenu(ev) { } function exploreOtherServers() { - // TODO: 言語をよしなに - window.open('https://join.misskey.page/ja-JP/instances', '_blank'); + window.open('https://join.misskey.page/instances', '_blank'); } </script> diff --git a/packages/frontend/src/components/global/MkPageHeader.vue b/packages/frontend/src/components/global/MkPageHeader.vue index ef8bfbbbfc..580816abaa 100644 --- a/packages/frontend/src/components/global/MkPageHeader.vue +++ b/packages/frontend/src/components/global/MkPageHeader.vue @@ -45,7 +45,7 @@ import { onMounted, onUnmounted, ref, inject } from 'vue'; import tinycolor from 'tinycolor2'; import XTabs, { Tab } from './MkPageHeader.tabs.vue'; import { scrollToTop } from '@/scripts/scroll.js'; -import { globalEvents } from '@/events'; +import { globalEvents } from '@/events.js'; import { injectPageMetadata } from '@/scripts/page-metadata.js'; import { $i, openAccountMenu as openAccountMenu_ } from '@/account.js'; |