From 0b1f2546c84da19596981897f4b29348686bdf67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Sun, 7 Apr 2024 11:10:15 -0400 Subject: [PATCH] fix: #12471, remove readable strings they are not localized properly --- public/openapi/components/schemas/UserObject.yaml | 4 +--- public/openapi/read/user/userslug/info.yaml | 2 -- src/user/info.js | 4 +--- 3 files changed, 2 insertions(+), 8 deletions(-) diff --git a/public/openapi/components/schemas/UserObject.yaml b/public/openapi/components/schemas/UserObject.yaml index bdd52bc2d1..9b217cee8b 100644 --- a/public/openapi/components/schemas/UserObject.yaml +++ b/public/openapi/components/schemas/UserObject.yaml @@ -743,9 +743,7 @@ BanMuteArray: example: "#f44336" until: type: number - untilReadable: - type: string - timestampReadable: + untilISO: type: string timestampISO: type: string diff --git a/public/openapi/read/user/userslug/info.yaml b/public/openapi/read/user/userslug/info.yaml index afec9bc2bd..110e252be5 100644 --- a/public/openapi/read/user/userslug/info.yaml +++ b/public/openapi/read/user/userslug/info.yaml @@ -35,8 +35,6 @@ get: timestampISO: type: string description: An ISO 8601 formatted date string (complementing `timestamp`) - timestampReadable: - type: string additionalProperties: description: Contextual data is added to this object (such as topic data, etc.) bans: diff --git a/src/user/info.js b/src/user/info.js index 3abd580d02..d4667bd83f 100644 --- a/src/user/info.js +++ b/src/user/info.js @@ -86,7 +86,6 @@ module.exports = function (User) { flagObj.pid = flagObj.value; flagObj.timestamp = flagObj.score; flagObj.timestampISO = new Date(flagObj.score).toISOString(); - flagObj.timestampReadable = new Date(flagObj.score).toString(); delete flagObj.value; delete flagObj.score; @@ -105,8 +104,7 @@ module.exports = function (User) { return data.map((banObj, index) => { banObj.user = usersData[index]; banObj.until = parseInt(banObj.expire, 10); - banObj.untilReadable = new Date(banObj.until).toString(); - banObj.timestampReadable = new Date(parseInt(banObj.timestamp, 10)).toString(); + banObj.untilISO = utils.toISOString(banObj.until); banObj.timestampISO = utils.toISOString(banObj.timestamp); banObj.reason = validator.escape(String(banObj.reason || '')) || noReasonLangKey; return banObj;