From 71fd01c8ec8ecdb58052f8cb7d0ada8b4d56464d Mon Sep 17 00:00:00 2001 From: Joffrey JAFFEUX Date: Wed, 28 Apr 2021 16:12:11 +0200 Subject: [PATCH] FIX: ensures successive topic hydrates doesn't override category (#12865) This bug has first been seen when loading similar topics, minimum repro: - Have a topic named "Something Foo Bar" with a category. - Call this in console: ``` Discourse.currentUser.store.find("similar-topic", { title: "Something foo bar", raw: "" }) ``` - Navigate to latest (no full refresh) - The category from the topic should have disappeared --- app/assets/javascripts/discourse/app/models/topic.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/assets/javascripts/discourse/app/models/topic.js b/app/assets/javascripts/discourse/app/models/topic.js index 5298b2b59b8..6dc8a68c650 100644 --- a/app/assets/javascripts/discourse/app/models/topic.js +++ b/app/assets/javascripts/discourse/app/models/topic.js @@ -614,6 +614,12 @@ Topic.reopenClass({ MUTED: 0, }, + munge(json) { + // ensure we are not overriding category computed property + delete json.category; + return json; + }, + createActionSummary(result) { if (result.actions_summary) { const lookup = EmberObject.create();