FIX: Hide timer info on topic status toggle (#25596)
Use topic.topic_status_update value to hide timer info after status change.
This commit is contained in:
parent
2323f09eb0
commit
53a198ad55
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -462,6 +462,7 @@
|
|||
<TopicTimerInfo
|
||||
@topicClosed={{this.model.closed}}
|
||||
@statusType={{this.model.topic_timer.status_type}}
|
||||
@statusUpdate={{this.model.topic_status_update}}
|
||||
@executeAt={{this.model.topic_timer.execute_at}}
|
||||
@basedOnLastPost={{this.model.topic_timer.based_on_last_post}}
|
||||
@durationMinutes={{this.model.topic_timer.duration_minutes}}
|
||||
|
|
|
@ -426,4 +426,55 @@ acceptance("Topic - Edit timer", function (needs) {
|
|||
|
||||
assert.notOk(exists(".topic-timer-heading"));
|
||||
});
|
||||
|
||||
test("Close timer removed after manual close", async function (assert) {
|
||||
updateCurrentUser({ moderator: true, trust_level: 4 });
|
||||
|
||||
await visit("/t/internationalization-localization");
|
||||
await click(".toggle-admin-menu");
|
||||
await click(".admin-topic-timer-update button");
|
||||
await click("#tap_tile_tomorrow");
|
||||
await click(".edit-topic-timer-modal button.btn-primary");
|
||||
|
||||
await click(".toggle-admin-menu");
|
||||
await click(".topic-admin-close button");
|
||||
|
||||
assert.notOk(exists(".topic-timer-heading"));
|
||||
});
|
||||
|
||||
test("Open timer removed after manual open", async function (assert) {
|
||||
updateCurrentUser({ moderator: true, trust_level: 4 });
|
||||
|
||||
await visit("/t/internationalization-localization");
|
||||
await click(".toggle-admin-menu");
|
||||
await click(".topic-admin-close button");
|
||||
|
||||
await click(".toggle-admin-menu");
|
||||
await click(".admin-topic-timer-update button");
|
||||
await click("#tap_tile_tomorrow");
|
||||
await click(".edit-topic-timer-modal button.btn-primary");
|
||||
|
||||
await click(".toggle-admin-menu");
|
||||
await click(".topic-admin-open button");
|
||||
|
||||
assert.notOk(exists(".topic-timer-heading"));
|
||||
});
|
||||
|
||||
test("timer removed after manual toggle close and open", async function (assert) {
|
||||
updateCurrentUser({ moderator: true, trust_level: 4 });
|
||||
|
||||
await visit("/t/internationalization-localization");
|
||||
await click(".toggle-admin-menu");
|
||||
await click(".admin-topic-timer-update button");
|
||||
await click("#tap_tile_tomorrow");
|
||||
await click(".edit-topic-timer-modal button.btn-primary");
|
||||
|
||||
await click(".toggle-admin-menu");
|
||||
await click(".topic-admin-close button");
|
||||
|
||||
await click(".toggle-admin-menu");
|
||||
await click(".topic-admin-open button");
|
||||
|
||||
assert.notOk(exists(".topic-timer-heading"));
|
||||
});
|
||||
});
|
||||
|
|
|
@ -2186,6 +2186,7 @@ export default {
|
|||
auto_close_at: null,
|
||||
auto_close_hours: null,
|
||||
auto_close_based_on_last_post: false,
|
||||
can_close_topic: true,
|
||||
created_by: {
|
||||
id: 255,
|
||||
username: "uwe_keim",
|
||||
|
|
Loading…
Reference in New Issue