diff --git a/CHANGELOG.md b/CHANGELOG.md index 8f428c1c15..71cecb5e84 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ - Enhance: Self-XSS防止用の警告を追加 - Enhance: カタルーニャ語 (ca-ES) に対応 - Enhance: 個別お知らせページではMetaタグを出力するように +- Enhance: 時刻表示を常に絶対時刻(年/月/日 時:分:秒)にできるように - Fix: 通知の範囲指定の設定項目が必要ない通知設定でも範囲指定の設定がでている問題を修正 - Fix: Turnstileが失敗・期限切れした際にも成功扱いとなってしまう問題を修正 (Cherry-picked from https://github.com/MisskeyIO/misskey/pull/768) diff --git a/locales/index.d.ts b/locales/index.d.ts index 440f24ac84..4e0eb51ad6 100644 --- a/locales/index.d.ts +++ b/locales/index.d.ts @@ -5218,6 +5218,10 @@ export interface Locale extends ILocale { * 利用可能なロール */ "availableRoles": string; + /** + * 常に絶対時刻で表示する + */ + "alwaysUseAbsoluteTime": string; "_accountSettings": { /** * コンテンツの表示にログインを必須にする diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml index 5d8e1a5e72..e8e3d44d48 100644 --- a/locales/ja-JP.yml +++ b/locales/ja-JP.yml @@ -1300,6 +1300,7 @@ thisContentsAreMarkedAsSigninRequiredByAuthor: "投稿者により、表示に lockdown: "ロックダウン" pleaseSelectAccount: "アカウントを選択してください" availableRoles: "利用可能なロール" +alwaysUseAbsoluteTime: "常に絶対時刻で表示する" _accountSettings: requireSigninToViewContents: "コンテンツの表示にログインを必須にする" diff --git a/packages/frontend/src/components/global/MkTime.vue b/packages/frontend/src/components/global/MkTime.vue index f600f7eed2..92cfdcba08 100644 --- a/packages/frontend/src/components/global/MkTime.vue +++ b/packages/frontend/src/components/global/MkTime.vue @@ -6,9 +6,9 @@ SPDX-License-Identifier: AGPL-3.0-only @@ -16,6 +16,7 @@ SPDX-License-Identifier: AGPL-3.0-only import isChromatic from 'chromatic/isChromatic'; import { onMounted, onUnmounted, ref, computed } from 'vue'; import { i18n } from '@/i18n.js'; +import { defaultStore } from '@/store.js'; import { dateTimeFormat } from '@@/js/intl-const.js'; const props = withDefaults(defineProps<{ @@ -23,9 +24,21 @@ const props = withDefaults(defineProps<{ origin?: Date | null; mode?: 'relative' | 'absolute' | 'detail'; colored?: boolean; + allowOverrideByUser?: boolean; }>(), { origin: isChromatic() ? () => new Date('2023-04-01T00:00:00Z') : null, mode: 'relative', + allowOverrideByUser: true, +}); + +const _mode = computed(() => { + if (props.mode === 'detail') return 'detail'; + + if (props.allowOverrideByUser && defaultStore.state.alwaysUseAbsoluteTime) { + return 'absolute'; + } else { + return props.mode; + } }); function getDateSafe(n: Date | string | number) { @@ -51,7 +64,7 @@ const now = ref(props.origin?.getTime() ?? Date.now()); const ago = computed(() => (now.value - _time) / 1000/*ms*/); const relative = computed(() => { - if (props.mode === 'absolute') return ''; // absoluteではrelativeを使わないので計算しない + if (_mode.value === 'absolute') return ''; // absoluteではrelativeを使わないので計算しない if (invalid) return i18n.ts._ago.invalid; return ( @@ -87,7 +100,7 @@ function tick() { } } -if (!invalid && props.origin === null && (props.mode === 'relative' || props.mode === 'detail')) { +if (!invalid && props.origin === null && (_mode.value === 'relative' || _mode.value === 'detail')) { onMounted(() => { tick(); }); diff --git a/packages/frontend/src/pages/settings/general.vue b/packages/frontend/src/pages/settings/general.vue index 1bfdfd0e76..5dd8337618 100644 --- a/packages/frontend/src/pages/settings/general.vue +++ b/packages/frontend/src/pages/settings/general.vue @@ -170,6 +170,7 @@ SPDX-License-Identifier: AGPL-3.0-only {{ i18n.ts.enableHorizontalSwipe }} {{ i18n.ts.alwaysConfirmFollow }} {{ i18n.ts.confirmWhenRevealingSensitiveMedia }} + {{ i18n.ts.alwaysUseAbsoluteTime }} @@ -319,6 +320,7 @@ const enableHorizontalSwipe = computed(defaultStore.makeGetterSetter('enableHori const useNativeUIForVideoAudioPlayer = computed(defaultStore.makeGetterSetter('useNativeUIForVideoAudioPlayer')); const alwaysConfirmFollow = computed(defaultStore.makeGetterSetter('alwaysConfirmFollow')); const confirmWhenRevealingSensitiveMedia = computed(defaultStore.makeGetterSetter('confirmWhenRevealingSensitiveMedia')); +const alwaysUseAbsoluteTime = computed(defaultStore.makeGetterSetter('alwaysUseAbsoluteTime')); const contextMenu = computed(defaultStore.makeGetterSetter('contextMenu')); watch(lang, () => { @@ -363,6 +365,7 @@ watch([ enableSeasonalScreenEffect, alwaysConfirmFollow, confirmWhenRevealingSensitiveMedia, + alwaysUseAbsoluteTime, contextMenu, ], async () => { await reloadAsk({ reason: i18n.ts.reloadToApplySetting, unison: true }); diff --git a/packages/frontend/src/store.ts b/packages/frontend/src/store.ts index 1d981e897b..9eff8d3bcc 100644 --- a/packages/frontend/src/store.ts +++ b/packages/frontend/src/store.ts @@ -474,6 +474,10 @@ export const defaultStore = markRaw(new Storage('base', { where: 'device', default: true, }, + alwaysUseAbsoluteTime: { + where: 'device', + default: false, + }, sound_masterVolume: { where: 'device',