From 53a198ad5541c4e7cdffbbc47d66266ab8bda0ba Mon Sep 17 00:00:00 2001 From: Shane Scanlon Date: Wed, 14 Feb 2024 11:40:40 -0500 Subject: [PATCH] FIX: Hide timer info on topic status toggle (#25596) Use topic.topic_status_update value to hide timer info after status change. --- .../app/components/topic-timer-info.js | 9 ++++ .../discourse/app/templates/topic.hbs | 1 + .../tests/acceptance/topic-edit-timer-test.js | 51 +++++++++++++++++++ .../discourse/tests/fixtures/topic.js | 1 + 4 files changed, 62 insertions(+) diff --git a/app/assets/javascripts/discourse/app/components/topic-timer-info.js b/app/assets/javascripts/discourse/app/components/topic-timer-info.js index 8d54e60675c..949a9457c3d 100644 --- a/app/assets/javascripts/discourse/app/components/topic-timer-info.js +++ b/app/assets/javascripts/discourse/app/components/topic-timer-info.js @@ -69,7 +69,16 @@ export default Component.extend({ const topicStatus = this.topicClosed ? "close" : "open"; const topicStatusKnown = this.topicClosed !== undefined; + const topicStatusUpdate = this.statusUpdate !== undefined; if (topicStatusKnown && topicStatus === this.statusType) { + if (!topicStatusUpdate) { + return; + } + + // The topic status has just been toggled, so we can hide the timer info. + this.set("showTopicTimer", null); + // The timer has already been removed on the back end. The front end is not aware of the change yet. + this.set("executeAt", null); return; } diff --git a/app/assets/javascripts/discourse/app/templates/topic.hbs b/app/assets/javascripts/discourse/app/templates/topic.hbs index 7a025c49098..b5cc8aec10a 100644 --- a/app/assets/javascripts/discourse/app/templates/topic.hbs +++ b/app/assets/javascripts/discourse/app/templates/topic.hbs @@ -462,6 +462,7 @@