# Automatically close solved topics after N hours

**URL:** https://meta.discourse.org/t/automatically-close-solved-topics-after-n-hours/58383
**Category:** Feature
**Tags:** solved
**Created:** [6 באוגוסט,‏ 2015,‏ 5:13am UTC](https://meta.discourse.org/t/automatically-close-solved-topics-after-n-hours/58383 "2015-08-06T05:13:59Z")
**Posts on this page:** 12
**Page:** 1

<div class="post-metadata">

### Author: ![adopilot](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/adopilot/32/105040_2.png) [@adopilot](https://meta.discourse.org/u/adopilot)
#### Post date: [6 באוגוסט,‏ 2015,‏ 5:13am UTC](https://meta.discourse.org/t/automatically-close-solved-topics-after-n-hours/58383/1 "2015-08-06T05:13:59Z")

</div>

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

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [4 במרץ,‏ 2017,‏ 11:07pm UTC](https://meta.discourse.org/t/automatically-close-solved-topics-after-n-hours/58383/2 "2017-03-04T23:07:18Z")

</div>

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

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [19 במאי,‏ 2017,‏ 1:23am UTC](https://meta.discourse.org/t/automatically-close-solved-topics-after-n-hours/58383/3 "2017-05-19T01:23:30Z")

</div>

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

---

<div class="post-metadata">

### Author: ![tgxworld](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tgxworld/32/106117_2.png) [@tgxworld](https://meta.discourse.org/u/tgxworld)
#### Post date: [19 במאי,‏ 2017,‏ 2:36am UTC](https://meta.discourse.org/t/automatically-close-solved-topics-after-n-hours/58383/5 "2017-05-19T02:36:41Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![tgxworld](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tgxworld/32/106117_2.png) [@tgxworld](https://meta.discourse.org/u/tgxworld)
#### Post date: [22 במאי,‏ 2017,‏ 9:13am UTC](https://meta.discourse.org/t/automatically-close-solved-topics-after-n-hours/58383/6 "2017-05-22T09:13:26Z")

</div>

PR in

[https://github.com/discourse/discourse-solved/pull/59](https://github.com/discourse/discourse-solved/pull/59)

---

<div class="post-metadata">

### Author: ![david](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/david/32/157490_2.png) [@david](https://meta.discourse.org/u/david)
#### Post date: [22 במאי,‏ 2017,‏ 10:28am UTC](https://meta.discourse.org/t/automatically-close-solved-topics-after-n-hours/58383/7 "2017-05-22T10:28:24Z")

</div>

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”?

---

<div class="post-metadata">

### Author: ![tgxworld](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tgxworld/32/106117_2.png) [@tgxworld](https://meta.discourse.org/u/tgxworld)
#### Post date: [22 במאי,‏ 2017,‏ 11:55am UTC](https://meta.discourse.org/t/automatically-close-solved-topics-after-n-hours/58383/8 "2017-05-22T11:55:00Z")

</div>

> [@david](#):
>
> If a post is “un-selected” as the solution, will the timer be cancelled?

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.

> [@david](#):
>
> Similarly, once the topic is closed, the answer can still be “unselected” - should this make the topic re-open?

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.

> [@david](#):
>
> Would it be better to replace “closing (n) hours after solution” with “closing (n) hours after last reply, if a solution has been chosen”?

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

---

<div class="post-metadata">

### Author: ![david](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/david/32/157490_2.png) [@david](https://meta.discourse.org/u/david)
#### Post date: [22 במאי,‏ 2017,‏ 12:13pm UTC](https://meta.discourse.org/t/automatically-close-solved-topics-after-n-hours/58383/9 "2017-05-22T12:13:52Z")

</div>

> [@tgxworld](#):
>
> Ah yes that is a good point, I’ve updated the PR to reflect that

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.

---

<div class="post-metadata">

### Author: ![tgxworld](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tgxworld/32/106117_2.png) [@tgxworld](https://meta.discourse.org/u/tgxworld)
#### Post date: [22 במאי,‏ 2017,‏ 12:18pm UTC](https://meta.discourse.org/t/automatically-close-solved-topics-after-n-hours/58383/10 "2017-05-22T12:18:46Z")

</div>

You were very clear actually 🙂

I think you missed

 ![](https://global.discourse-cdn.com/meta/original/3X/a/a/aa4186e3afa3b20efe0844a3bfa9a99e669d3e9d.png)

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

---

<div class="post-metadata">

### Author: ![david](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/david/32/157490_2.png) [@david](https://meta.discourse.org/u/david)
#### Post date: [22 במאי,‏ 2017,‏ 12:21pm UTC](https://meta.discourse.org/t/automatically-close-solved-topics-after-n-hours/58383/11 "2017-05-22T12:21:06Z")

</div>

Ah yes, will read more closely next time 🙈

---

<div class="post-metadata">

### Author: ![SidV](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sidv/32/119460_2.png) [@SidV](https://meta.discourse.org/u/SidV)
#### Post date: [26 במאי,‏ 2017,‏ 12:27pm UTC](https://meta.discourse.org/t/automatically-close-solved-topics-after-n-hours/58383/12 "2017-05-26T12:27:34Z")

</div>

OMG … **THANK YOU** team for this feature !

Ps: spanish translation updated (_[PR60](https://github.com/discourse/discourse-solved/pull/60)_)

---

<div class="post-metadata">

### Author: ![tgxworld](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tgxworld/32/106117_2.png) [@tgxworld](https://meta.discourse.org/u/tgxworld)
#### Post date: [1 ביוני,‏ 2017,‏ 9:00am UTC](https://meta.discourse.org/t/automatically-close-solved-topics-after-n-hours/58383/13 "2017-06-01T09:00:16Z")

</div>

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