FIX: Hide timer info on topic status toggle #25596
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix for https://meta.discourse.org/t/minor-ui-bug-with-manually-closing-a-topic-that-has-a-topic-timer-set-for-auto-close-in-the-future/289482
When an auto close/open timer is set and the user manually opens/closes the topic, the timer info remains displayed until the page is refreshed.
The changes here fix that by adding a
@statusUpdate
property to the timer info within the topic template.The
@statusUpdate
property is read in thetopic-timer-info
component. When this value is defined, and the timerstatusType
matches the the topic status, the timer infoshowTopicTimer
andexecutedAt
values are set to null. The latter is modified to prevent the info from being incorrectly displayed if the user toggles the status back to open.The
@statusUpdate
property is set to the value of the topictopic_status_update
which is undefined by default. After the topic controllertoggleClosed
function finishes, this value is updated with the return value from the API. This in turn triggers another render of thetopic-timer-info
component which now has the information it needs to hide itself.This does trigger an additional render of the timer info after the hooks are fired, but I felt it was acceptable.
Three acceptance tests have been added to topic-edit-timer-test.js.
The topic test fixture needed a minor adjustment to enable toggling the topic status.