Skip to content

Node.js based forum software built for the modern web

fix(spec): always show thumb in topic response

Julian Lam493c568a759a
diff --git a/public/openapi/components/schemas/PostObject.yaml b/public/openapi/components/schemas/PostObject.yaml
index 5ff918cd7f..526bc2c75e 100644
--- a/public/openapi/components/schemas/PostObject.yaml
+++ b/public/openapi/components/schemas/PostObject.yaml
@@ -74,6 +74,9 @@ PostObject:
description: A category identifier
slug:
type: string
+ thumb:
+ type: string
+ description: An uploaded topic thumbnail
deleted:
type: number
postcount:
diff --git a/public/openapi/components/schemas/TopicObject.yaml b/public/openapi/components/schemas/TopicObject.yaml
index 10453fe22b..6f2c45cfcf 100644
--- a/public/openapi/components/schemas/TopicObject.yaml
+++ b/public/openapi/components/schemas/TopicObject.yaml
@@ -41,6 +41,9 @@ TopicObject:
type: number
locked:
type: number
+ thumb:
+ type: string
+ description: An uploaded topic thumbnail
pinned:
type: number
description: Whether or not this particular topic is pinned to the top of the
@@ -221,8 +224,6 @@ TopicObject:
description: HTML injected into the theme
index:
type: number
- thumb:
- type: string
required:
- tid
- uid
diff --git a/public/openapi/read/topic/tid/id.yaml b/public/openapi/read/topic/tid/id.yaml
index cdc638a1f5..fab2532476 100644
--- a/public/openapi/read/topic/tid/id.yaml
+++ b/public/openapi/read/topic/tid/id.yaml
@@ -42,6 +42,9 @@ get:
type: number
viewcount:
type: number
+ thumb:
+ type: string
+ description: An uploaded topic thumbnail
deleted:
type: number
locked:
diff --git a/public/openapi/read/topic/topic_id.yaml b/public/openapi/read/topic/topic_id.yaml
index c55c6888cd..d293d37ce5 100644
--- a/public/openapi/read/topic/topic_id.yaml
+++ b/public/openapi/read/topic/topic_id.yaml
@@ -53,6 +53,9 @@ get:
type: number
viewcount:
type: number
+ thumb:
+ type: string
+ description: An uploaded topic thumbnail
postercount:
type: number
description: The number of unique users who made a post in this topic
diff --git a/public/openapi/read/unread.yaml b/public/openapi/read/unread.yaml
index a5fe83348e..9af7956705 100644
--- a/public/openapi/read/unread.yaml
+++ b/public/openapi/read/unread.yaml
@@ -49,6 +49,9 @@ get:
type: number
viewcount:
type: number
+ thumb:
+ type: string
+ description: An uploaded topic thumbnail
postercount:
type: number
teaserPid:
diff --git a/src/topics/data.js b/src/topics/data.js
index 720d2e63ad..d33ddb29d0 100644
--- a/src/topics/data.js
+++ b/src/topics/data.js
@@ -98,9 +98,7 @@ function modifyTopic(topic, fields) {
escapeTitle(topic);
- if (topic.hasOwnProperty('thumb')) {
- topic.thumb = validator.escape(String(topic.thumb));
- }
+ topic.thumb = validator.escape(String(topic.thumb)) || '';
if (topic.hasOwnProperty('timestamp')) {
topic.timestampISO = utils.toISOString(topic.timestamp);