# Auto Close topic after 24 or 96 hours not working as expected

**URL:** https://meta.discourse.org/t/auto-close-topic-after-24-or-96-hours-not-working-as-expected/28900
**Category:** Bug
**Created:** [May 16, 2015, 9:11pm UTC](https://meta.discourse.org/t/auto-close-topic-after-24-or-96-hours-not-working-as-expected/28900 "2015-05-16T21:11:40Z")
**Posts on this page:** 12
**Page:** 1

<div class="post-metadata">

### Author: ![DeanMarkTaylor](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/deanmarktaylor/32/102462_2.png) [@DeanMarkTaylor](https://meta.discourse.org/u/DeanMarkTaylor)
#### Post date: [May 16, 2015, 9:11pm UTC](https://meta.discourse.org/t/auto-close-topic-after-24-or-96-hours-not-working-as-expected/28900/1 "2015-05-16T21:11:40Z")

</div>

This may have been caught and fixed already…

When a topic is set to close after 24 or 96 hours after last reply it appears close immediately.

`96` and `24` are the only values I have tried.

 ![](https://global.discourse-cdn.com/meta/original/3X/b/e/becd6b6d647ab031a5c1e0370e54bfa95a17cc6f.png) 

The following post is added after a minute or so:

> This topic was automatically closed 0 minutes after the last reply. New replies are no longer allowed.

This has not been tested on latest - but it was in this version:  
`Discourse 1.3.0.beta7 - https://github.com/discourse/discourse version 875a013ec76e7ce0cbb95a61223cbbd16ed31d4a`

I did however check the first line of all commit comments for the last 17 days - only one mentioned “auto” and it wasn’t to do with closing a topic.

* * *

### After thought

The last post was 10 days ago however.

But I was expecting the topic to close 24 / 96 hours from the time it was set to auto close (if there wasn’t a new post before then).

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [May 16, 2015, 9:22pm UTC](https://meta.discourse.org/t/auto-close-topic-after-24-or-96-hours-not-working-as-expected/28900/2 "2015-05-16T21:22:23Z")

</div>

If this was broken we would know as BBS boing boing would have problems. They have an auto close main category there.

Possible there is an issue with close after last reply though. We can try it on this topic.

---

<div class="post-metadata">

### Author: ![DeanMarkTaylor](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/deanmarktaylor/32/102462_2.png) [@DeanMarkTaylor](https://meta.discourse.org/u/DeanMarkTaylor)
#### Post date: [May 16, 2015, 9:35pm UTC](https://meta.discourse.org/t/auto-close-topic-after-24-or-96-hours-not-working-as-expected/28900/3 "2015-05-16T21:35:16Z")

</div>

I’m guessing it’s that applying an “Auto Close based on last post” to a topic where the last post is older than the Auto Close duration closes it immediately…  
… which for me was unexpected - as I wished for at least the Auto Close duration to pass first.

---

<div class="post-metadata">

### Author: ![riking](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/riking/32/170938_2.png) [@riking](https://meta.discourse.org/u/riking)
#### Post date: [May 16, 2015, 9:40pm UTC](https://meta.discourse.org/t/auto-close-topic-after-24-or-96-hours-not-working-as-expected/28900/4 "2015-05-16T21:40:59Z")

</div>

Okay, I think a warning in that case would suffice. And fixing the close message.

```plaintext
<div class="warning">
    <i class="fa fa-warning"></i> The last post in the topic is already 24 hours old, so the topic will be closed immediately.
  </div>

```

 ![](https://global.discourse-cdn.com/meta/original/3X/2/b/2b8df694f85e3d512dc87b22717786b57bd095b1.png)

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [May 16, 2015, 10:32pm UTC](https://meta.discourse.org/t/auto-close-topic-after-24-or-96-hours-not-working-as-expected/28900/5 "2015-05-16T22:32:40Z")

</div>

Well that is a bug @neil it should not apply to the last post at the time of creating the rule!

---

<div class="post-metadata">

### Author: ![riking](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/riking/32/170938_2.png) [@riking](https://meta.discourse.org/u/riking)
#### Post date: [May 16, 2015, 11:03pm UTC](https://meta.discourse.org/t/auto-close-topic-after-24-or-96-hours-not-working-as-expected/28900/6 "2015-05-16T23:03:04Z")

</div>

[https://github.com/discourse/discourse/pull/3481](https://github.com/discourse/discourse/pull/3481)

If you give a time for “after the last post” that would apply to right now, it gives you a warning, and skips the queue if you submit.

* * *

edit: ~~should~~ added tests

---

<div class="post-metadata">

### Author: ![neil](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/neil/32/102150_2.png) [@neil](https://meta.discourse.org/u/neil)
#### Post date: [June 18, 2015, 2:26pm UTC](https://meta.discourse.org/t/auto-close-topic-after-24-or-96-hours-not-working-as-expected/28900/7 "2015-06-18T14:26:18Z")

</div>



---

<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: [December 1, 2015, 1:32am UTC](https://meta.discourse.org/t/auto-close-topic-after-24-or-96-hours-not-working-as-expected/28900/8 "2015-12-01T01:32:31Z")

</div>



---

<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: [December 1, 2015, 1:32am UTC](https://meta.discourse.org/t/auto-close-topic-after-24-or-96-hours-not-working-as-expected/28900/9 "2015-12-01T01:32:56Z")

</div>

Is this really fixed? PR is still in Limbo @riking [Fixes for topic auto closing by riking · Pull Request #3481 · discourse/discourse · GitHub](https://github.com/discourse/discourse/pull/3481)

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [December 7, 2015, 11:17am UTC](https://meta.discourse.org/t/auto-close-topic-after-24-or-96-hours-not-working-as-expected/28900/10 "2015-12-07T11:17:34Z")

</div>

Can you add this to your list @techapj to check into, eventually.

---

<div class="post-metadata">

### Author: ![techAPJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/techapj/32/342990_2.png) [@techAPJ](https://meta.discourse.org/u/techAPJ)
#### Post date: [December 8, 2015, 12:52pm UTC](https://meta.discourse.org/t/auto-close-topic-after-24-or-96-hours-not-working-as-expected/28900/11 "2015-12-08T12:52:55Z")

</div>

Merged in via:

[https://github.com/discourse/discourse/commit/e52852dd0f2bd2f185466d16165565bbc1f29a2c](https://github.com/discourse/discourse/commit/e52852dd0f2bd2f185466d16165565bbc1f29a2c)

Thanks @riking 🎉

---

<div class="post-metadata">

### Author: ![techAPJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/techapj/32/342990_2.png) [@techAPJ](https://meta.discourse.org/u/techAPJ)
#### Post date: [December 8, 2015, 12:53pm UTC](https://meta.discourse.org/t/auto-close-topic-after-24-or-96-hours-not-working-as-expected/28900/12 "2015-12-08T12:53:30Z")

</div>


