Set a topic timer to close a topic in x days
Close the topic manually
You can see a row still showing that the topic will close in x days
Click the trash icon on this and you get an error message:
Obviously very minor, I love Discourse and everything that you’re doing, but thought it was worth mentioning Thanks
5 Likes
sam
(Sam Saffron)
December 22, 2023, 2:24am
2
Thanks for raising it, I put pr-welcome on this in case a community member would like to explore a fix.
2 Likes
I’m interested in implementing a fix for this. I’m new here, is there an assignment process for pr-welcome topics?
3 Likes
Hello and welcome! Your comment saying “working on it” suffices plenty for an assignment process - Send over your PR to github when it’s ready, and we can take a look
3 Likes
The PR has been sent. Thanks!
discourse:main
← turtlestackdev:fix/topic_timer_visible_after_status_toggle
opened 09:46PM - 07 Feb 24 UTC
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 the `topic-timer-info` component. When this value is defined, and the timer `statusType` matches the the topic status, the timer info `showTopicTimer` and `executedAt` 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 topic `topic_status_update` which is undefined by default. After the topic controller `toggleClosed` function finishes, this value is updated with the return value from the API. This in turn triggers another render of the `topic-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.
- auto-close timer is hidden after manually closing the topic
- auto-open timer is hidden after manually opening the topic
- auto-close timer is hidden after manually closing and then re-opening the topic
The topic test fixture needed a minor adjustment to enable toggling the topic status.
5 Likes