UX: clear topic timer text when manually closing/opening (#6123)

* UX: clear topic timer text when manually closing/opening

* added test for clearing topic timer status text
This commit is contained in:
Kyle Zhao
2018-07-26 11:48:38 +10:00
committed by Sam
parent 9ccdc0da76
commit 1ed3a89ac9
3 changed files with 62 additions and 0 deletions
@@ -8,6 +8,7 @@ export default Ember.Component.extend(
_delayedRerender: null,
rerenderTriggers: [
"topicClosed",
"statusType",
"executeAt",
"basedOnLastPost",
@@ -18,6 +19,10 @@ export default Ember.Component.extend(
buildBuffer(buffer) {
if (!this.get("executeAt")) return;
const topicStatus = this.get("topicClosed") ? "close" : "open";
const topicStatusKnown = this.get("topicClosed") !== undefined;
if (topicStatusKnown && topicStatus === this.get("statusType")) return;
let statusUpdateAt = moment(this.get("executeAt"));
let duration = moment.duration(statusUpdateAt - moment());
@@ -223,12 +223,14 @@
{{#if model.private_topic_timer.execute_at}}
{{topic-timer-info
topicClosed=model.closed
statusType=model.private_topic_timer.status_type
executeAt=model.private_topic_timer.execute_at
duration=model.private_topic_timer.duration}}
{{/if}}
{{topic-timer-info
topicClosed=model.closed
statusType=model.topic_timer.status_type
executeAt=model.topic_timer.execute_at
basedOnLastPost=model.topic_timer.based_on_last_post