Skip to content

Node.js based forum software built for the modern web

test: fix spec

Barış Soner Uşaklı0e2a42d547ab
diff --git a/public/openapi/components/schemas/Chats.yaml b/public/openapi/components/schemas/Chats.yaml
index 036b937158..3d4339c083 100644
--- a/public/openapi/components/schemas/Chats.yaml
+++ b/public/openapi/components/schemas/Chats.yaml
@@ -108,6 +108,10 @@ MessageObject:
`icon:text` for the user's
auto-generated icon
example: "#f44336"
+ banned_until:
+ type: number
+ description: A UNIX timestamp representing the moment a ban will be lifted
+ example: 0
banned_until_readable:
type: string
description: An ISO 8601 formatted date string representing the moment a ban will be lifted, or the words "Not Banned"
diff --git a/public/openapi/components/schemas/TopicObject.yaml b/public/openapi/components/schemas/TopicObject.yaml
index 64c47f0daa..605c32de85 100644
--- a/public/openapi/components/schemas/TopicObject.yaml
+++ b/public/openapi/components/schemas/TopicObject.yaml
@@ -60,8 +60,6 @@ TopicObject:
signature:
type: string
nullable: true
- banned:
- type: number
status:
type: string
icon:text:
@@ -76,6 +74,10 @@ TopicObject:
`icon:text` for the user's auto-generated
icon
example: "#f44336"
+ banned:
+ type: number
+ banned_until:
+ type: number
banned_until_readable:
type: string
required:
diff --git a/public/openapi/components/schemas/UserObject.yaml b/public/openapi/components/schemas/UserObject.yaml
index 5dc0da6bf4..61d98b1f80 100644
--- a/public/openapi/components/schemas/UserObject.yaml
+++ b/public/openapi/components/schemas/UserObject.yaml
@@ -681,6 +681,10 @@ UserObjectACP:
lastonlineISO:
type: string
example: '2020-03-27T20:30:36.590Z'
+ banned_until:
+ type: number
+ description: A UNIX timestamp representing the moment a ban will be lifted
+ example: 0
banned_until_readable:
type: string
description: An ISO 8601 formatted date string representing the moment a ban will be lifted, or the words "Not Banned"
diff --git a/public/openapi/read/unread.yaml b/public/openapi/read/unread.yaml
index 77e9ec44f6..6ae0e8500e 100644
--- a/public/openapi/read/unread.yaml
+++ b/public/openapi/read/unread.yaml
@@ -109,6 +109,8 @@ get:
`icon:text` for the user's auto-generated
icon
example: "#f44336"
+ banned_until:
+ type: number
banned_until_readable:
type: string
required:
diff --git a/public/openapi/read/user/userslug/chats/roomid.yaml b/public/openapi/read/user/userslug/chats/roomid.yaml
index 73c4a62da9..448f350a42 100644
--- a/public/openapi/read/user/userslug/chats/roomid.yaml
+++ b/public/openapi/read/user/userslug/chats/roomid.yaml
@@ -124,6 +124,8 @@ get:
`icon:text` for the user's auto-generated
icon
example: "#f44336"
+ banned_until:
+ type: number
banned_until_readable:
type: string
deleted:
diff --git a/public/openapi/write/categories/cid/moderator/uid.yaml b/public/openapi/write/categories/cid/moderator/uid.yaml
index 3e7223d1d7..bbba82c7c6 100644
--- a/public/openapi/write/categories/cid/moderator/uid.yaml
+++ b/public/openapi/write/categories/cid/moderator/uid.yaml
@@ -79,6 +79,10 @@ put:
type: number
description: A Boolean representing whether a user is banned or not
example: 0
+ banned_until:
+ type: number
+ description: A UNIX timestamp representing the moment a ban will be lifted
+ example: 0
banned_until_readable:
type: string
description: An ISO 8601 formatted date string representing the moment a ban will be lifted, or the words "Not Banned"
diff --git a/src/user/data.js b/src/user/data.js
index 80a9b5d9bf..d45e4a6259 100644
--- a/src/user/data.js
+++ b/src/user/data.js
@@ -275,7 +275,7 @@ module.exports = function (User) {
user.joindateISO = utils.toISOString(user.joindate);
}
- if (user.hasOwnProperty('lastonline')) {
+ if (user.hasOwnProperty('lastonline') && (!requestedFields.length || requestedFields.includes('lastonline')) && !fieldsToRemove.includes('lastonline')) {
user.lastonlineISO = utils.toISOString(user.lastonline) || user.joindateISO;
}