Skip to content

Node.js based forum software built for the modern web

chore: stop loading user signatures in topic lists (#14640)

palmoni5766fb6aa80e2
diff --git a/public/openapi/components/schemas/TopicObject.yaml b/public/openapi/components/schemas/TopicObject.yaml
index 68ae3c1236..2d1aa9dcf6 100644
--- a/public/openapi/components/schemas/TopicObject.yaml
+++ b/public/openapi/components/schemas/TopicObject.yaml
@@ -57,9 +57,6 @@ TopicObject:
picture:
type: string
nullable: true
- signature:
- type: string
- nullable: true
status:
type: string
icon:text:
@@ -87,7 +84,6 @@ TopicObject:
- reputation
- postcount
- picture
- - signature
- banned
- status
- icon:text
diff --git a/public/openapi/read/tags/tag.yaml b/public/openapi/read/tags/tag.yaml
index 6756e16e2b..8ce04974ca 100644
--- a/public/openapi/read/tags/tag.yaml
+++ b/public/openapi/read/tags/tag.yaml
@@ -127,9 +127,6 @@ get:
picture:
nullable: true
type: string
- signature:
- nullable: true
- type: string
banned:
type: number
status:
diff --git a/public/openapi/read/unread.yaml b/public/openapi/read/unread.yaml
index 763449bade..fc04442d67 100644
--- a/public/openapi/read/unread.yaml
+++ b/public/openapi/read/unread.yaml
@@ -91,9 +91,6 @@ get:
picture:
nullable: true
type: string
- signature:
- nullable: true
- type: string
banned:
type: boolean
status:
@@ -121,7 +118,6 @@ get:
- reputation
- postcount
- picture
- - signature
- banned
- status
- icon:text
diff --git a/src/topics/index.js b/src/topics/index.js
index 4b7ccfb052..50a507a527 100644
--- a/src/topics/index.js
+++ b/src/topics/index.js
@@ -101,7 +101,7 @@ Topics.getTopicsByTids = async function (tids, options) {
const [teasers, users, userSettings, categoriesData, guestHandles, thumbs] = await Promise.all([
Topics.getTeasers(topics, options),
- user.getUsersFields(uids, ['uid', 'username', 'fullname', 'userslug', 'reputation', 'postcount', 'picture', 'signature', 'banned', 'status']),
+ user.getUsersFields(uids, ['uid', 'username', 'fullname', 'userslug', 'reputation', 'postcount', 'picture', 'banned', 'status']),
loadShowfullnameSettings(),
categories.getCategoriesFields(cids, ['cid', 'name', 'slug', 'icon', 'backgroundImage', 'imageClass', 'bgColor', 'color', 'disabled']),
loadGuestHandles(),
diff --git a/test/topics.js b/test/topics.js
index 57f850d0d5..10c27cbb8e 100644
--- a/test/topics.js
+++ b/test/topics.js
@@ -2370,6 +2370,19 @@ describe('Topic\'s', () => {
assert.strictEqual(data.topics[0].title, 'old replied');
assert.strictEqual(data.topics[1].title, 'most recent replied');
});
+
+ it('should not expose the author signature', async () => {
+ await User.setUserField(topic.userId, 'signature', 'some signature');
+ const data = await topics.getSortedTopics({
+ cids: [category.cid],
+ uid: topic.userId,
+ start: 0,
+ stop: -1,
+ sort: 'recent',
+ });
+ assert(data.topics[0].user);
+ assert.strictEqual(data.topics[0].user.signature, undefined);
+ });
});
describe('scheduled topics', () => {