Commit 481175f
committed
DEV: Add backward compatibility for tag object arrays
What is the problem?
Discourse core PR #36678 changes `site.top_tags` and
`site.category_top_tags` from string arrays (e.g., `["support", "bug"]`)
to object arrays (e.g., `[{id: 12, name: "support", slug: "support"}]`).
This breaks the `PopularTags` component which filters and displays tags
as strings.
What is the solution?
Normalize the tags array by mapping and extracting names using
`typeof tag === "string" ? tag : tag.name` before filtering against
excluded tags. This ensures backward compatibility with both the old
string format and the new object format.1 parent f3e1845 commit 481175f
File tree
2 files changed
+25
-2
lines changed- javascripts/discourse/components
- spec/system
2 files changed
+25
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
27 | 30 | | |
28 | | - | |
| 31 | + | |
29 | 32 | | |
30 | 33 | | |
31 | 34 | | |
32 | 35 | | |
33 | 36 | | |
34 | | - | |
| 37 | + | |
35 | 38 | | |
36 | 39 | | |
37 | 40 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
0 commit comments