From 5f5712a3ee1cf61acec69e60215a4155c882c3b1 Mon Sep 17 00:00:00 2001 From: syuilo Date: Fri, 17 Nov 2023 15:33:57 +0900 Subject: [PATCH 1/8] =?UTF-8?q?fix(frontend):=20MFM=20unixtime=E3=81=AE?= =?UTF-8?q?=E3=83=97=E3=83=AC=E3=83=93=E3=83=A5=E3=83=BC=E3=81=8C=E3=83=AA?= =?UTF-8?q?=E3=82=A2=E3=83=AB=E3=82=BF=E3=82=A4=E3=83=A0=E3=81=A7=E5=8F=8D?= =?UTF-8?q?=E6=98=A0=E3=81=95=E3=82=8C=E3=81=AA=E3=81=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix #12350 --- .../src/components/global/MkMisskeyFlavoredMarkdown.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/frontend/src/components/global/MkMisskeyFlavoredMarkdown.ts b/packages/frontend/src/components/global/MkMisskeyFlavoredMarkdown.ts index b10a12b504..c5f247bce9 100644 --- a/packages/frontend/src/components/global/MkMisskeyFlavoredMarkdown.ts +++ b/packages/frontend/src/components/global/MkMisskeyFlavoredMarkdown.ts @@ -260,7 +260,11 @@ export default function(props: MfmProps) { class: 'ti ti-clock', style: 'margin-right: 0.25em;', }), - h(MkTime, { time: unixtime * 1000, mode: 'detail' }), + h(MkTime, { + key: Math.random(), + time: unixtime * 1000, + mode: 'detail', + }), ]); } } From 4b3f9bd9a624793b467e9b07afdf58b86cf40d17 Mon Sep 17 00:00:00 2001 From: syuilo Date: Fri, 17 Nov 2023 15:44:36 +0900 Subject: [PATCH 2/8] =?UTF-8?q?enhance(backend):=20MFM=E3=81=AEunixtime?= =?UTF-8?q?=E3=82=92ISO=E5=BD=A2=E5=BC=8F=E3=81=A7=E9=80=A3=E5=90=88?= =?UTF-8?q?=E3=81=99=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/backend/src/core/MfmService.ts | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/packages/backend/src/core/MfmService.ts b/packages/backend/src/core/MfmService.ts index b275d1b142..af602168d4 100644 --- a/packages/backend/src/core/MfmService.ts +++ b/packages/backend/src/core/MfmService.ts @@ -276,9 +276,18 @@ export class MfmService { }, fn: (node) => { - const el = doc.createElement('i'); - appendChildren(node.children, el); - return el; + if (node.props.name === 'unixtime') { + const text = node.children[0]!.type === 'text' ? node.children[0].props.text : ''; + const date = new Date(parseInt(text, 10) * 1000); + const el = doc.createElement('time'); + el.setAttribute('datetime', date.toISOString()); + el.textContent = date.toISOString(); + return el; + } else { + const el = doc.createElement('i'); + appendChildren(node.children, el); + return el; + } }, blockCode: (node) => { From 4a7ccf6deb94954e1c832bb81f0c2a415c3c31a3 Mon Sep 17 00:00:00 2001 From: syuilo Date: Fri, 17 Nov 2023 17:54:13 +0900 Subject: [PATCH 3/8] tweak MkTime.vue --- packages/frontend/src/components/global/MkTime.vue | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/packages/frontend/src/components/global/MkTime.vue b/packages/frontend/src/components/global/MkTime.vue index 61e65a8dcf..f08d538fc0 100644 --- a/packages/frontend/src/components/global/MkTime.vue +++ b/packages/frontend/src/components/global/MkTime.vue @@ -49,15 +49,14 @@ const relative = $computed(() => { ago >= 3600 ? i18n.t('_ago.hoursAgo', { n: Math.round(ago / 3600).toString() }) : ago >= 60 ? i18n.t('_ago.minutesAgo', { n: (~~(ago / 60)).toString() }) : ago >= 10 ? i18n.t('_ago.secondsAgo', { n: (~~(ago % 60)).toString() }) : - ago >= -1 ? i18n.ts._ago.justNow : + ago >= -3 ? i18n.ts._ago.justNow : ago < -31536000 ? i18n.t('_timeIn.years', { n: Math.round(-ago / 31536000).toString() }) : ago < -2592000 ? i18n.t('_timeIn.months', { n: Math.round(-ago / 2592000).toString() }) : ago < -604800 ? i18n.t('_timeIn.weeks', { n: Math.round(-ago / 604800).toString() }) : ago < -86400 ? i18n.t('_timeIn.days', { n: Math.round(-ago / 86400).toString() }) : ago < -3600 ? i18n.t('_timeIn.hours', { n: Math.round(-ago / 3600).toString() }) : ago < -60 ? i18n.t('_timeIn.minutes', { n: (~~(-ago / 60)).toString() }) : - ago < -10 ? i18n.t('_timeIn.seconds', { n: (~~(-ago % 60)).toString() }) : - '?' + i18n.t('_timeIn.seconds', { n: (~~(-ago % 60)).toString() }) ); }); From 08b3662bb8510d45eb8edd48768a570907afcd44 Mon Sep 17 00:00:00 2001 From: syuilo Date: Fri, 17 Nov 2023 18:00:42 +0900 Subject: [PATCH 4/8] chore(frontend): tweak ui --- packages/frontend/src/pages/settings/notifications.vue | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/frontend/src/pages/settings/notifications.vue b/packages/frontend/src/pages/settings/notifications.vue index 2222381df6..7b09c6c900 100644 --- a/packages/frontend/src/pages/settings/notifications.vue +++ b/packages/frontend/src/pages/settings/notifications.vue @@ -8,7 +8,7 @@ SPDX-License-Identifier: AGPL-3.0-only
- +