From bcc549f1dd758c15d6006465ece3156e06acec64 Mon Sep 17 00:00:00 2001 From: Natalie Tay Date: Mon, 12 Jan 2026 11:15:14 +0800 Subject: [PATCH] FIX: Compatibility with new topic.tag return value (#132) As part of https://github.com/discourse/discourse/pull/36678, topic.tags now returns an array of tag objects ({ id, name, slug }) instead of an array of tag name strings. The core change will break the auto_TOC_tags feature which was comparing the configured tag names against topic.tags using includes(), which no longer worked since it was comparing strings to objects. This fix normalizes topic.tags to an array of tag names before comparison, maintaining backwards compatibility with both the old string format and the new object format. --- javascripts/discourse/services/toc-processor.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/javascripts/discourse/services/toc-processor.js b/javascripts/discourse/services/toc-processor.js index df676ce..5c6b464 100644 --- a/javascripts/discourse/services/toc-processor.js +++ b/javascripts/discourse/services/toc-processor.js @@ -121,7 +121,9 @@ export default class TocProcessor extends Service { } const topicCategory = topic.category_id; - const topicTags = topic.tags || []; + const topicTags = (topic.tags || []).map((t) => + typeof t === "string" ? t : t.name + ); const hasMatchingTags = autoTags.some((tag) => topicTags.includes(tag)); const hasMatchingCategory = autoCategories.includes(topicCategory);