Automatically close solved topics after N hours


(Admir Hodzic) #1

My apologies if it was mentioned already
But it will be great if we could set autoclose after X hours for resolved topics.


If it solved, reduce the time for auto-close?
Discourse Solved (Accepted answer plugin)
Responding to "solved" topics
(Sam Saffron) #2

I like this feature request and would love to add this option to the plugin. #pr-welcome


(Sam Saffron) #3

@tgxworld given your recent changes, how simple would it be to add this to the solved plugin?


(Alan Tan) #5

Pretty simple, just have to call topic.set_or_create_timer(TopicTimer.types[:close], SiteSetting.solved_topics_auto_close_hours) once the topic is marked as solved.


(Alan Tan) #6

PR in


(David Taylor) #7

A few questions:

  • If a post is “un-selected” as the solution, will the timer be cancelled?
  • Similarly, once the topic is closed, the answer can still be “unselected” - should this make the topic re-open?
  • What if people continue replying to the topic after a solution has been chosen? Would it be better to replace “closing (n) hours after solution” with “closing (n) hours after last reply, if a solution has been chosen”?

(Alan Tan) #8

I guess it should but it’ll be tricky to implement. We’ll have to track the context in which the timer was created in and cancel timers based on that context. I’ll have a look to see what the possibility is like but I think having the admin cancel the topic timer manually should be sufficient for the first pass.

I don’t think it should auto reopen if the answer is un-selected. In fact, I think it is a bug that the answer can be unselected when the topic is already closed.

Ah yes that is a good point, I’ve updated the PR to reflect that. Thank you :thumbsup:


(David Taylor) #9

Sorry, I realise now I wasn’t particularly clear. I was referring to the actual functionality rather than the copy. From looking at the code it seems like it’ll close the topic, even if people are still replying to it.


(Alan Tan) #10

You were very clear actually :slight_smile:

I think you missed

while reading through the code. That was how the feature should have been from the start :thumbsup:


(David Taylor) #11

Ah yes, will read more closely next time :see_no_evil:


#12

OMG … THANK YOU team for this feature !

Ps: spanish translation updated (PR60)


(Alan Tan) #13

This topic was automatically closed after 35 hours. New replies are no longer allowed.