# Callback for topic\_closed and topic\_reopened

**URL:** https://meta.discourse.org/t/callback-for-topic-closed-and-topic-reopened/39989
**Category:** Development
**Created:** [February 22, 2016, 5:28pm UTC](https://meta.discourse.org/t/callback-for-topic-closed-and-topic-reopened/39989 "2016-02-22T17:28:43Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![joebuhlig](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/joebuhlig/32/193054_2.png) [@joebuhlig](https://meta.discourse.org/u/joebuhlig)
#### Post date: [February 22, 2016, 5:28pm UTC](https://meta.discourse.org/t/callback-for-topic-closed-and-topic-reopened/39989/1 "2016-02-22T17:28:43Z")

</div>

I need to run a sidekiq job in these two cases. My original thought was to extend the Topic model with an after\_save method, but wondered if there was a better way triggered off of these events. I searched the source code for ways to hook into these but couldn’t see a way. Do these exist and I’m not seeing it?

---

<div class="post-metadata">

### Author: ![joebuhlig](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/joebuhlig/32/193054_2.png) [@joebuhlig](https://meta.discourse.org/u/joebuhlig)
#### Post date: [February 23, 2016, 9:33pm UTC](https://meta.discourse.org/t/callback-for-topic-closed-and-topic-reopened/39989/2 "2016-02-23T21:33:03Z")

</div>

Turns out that an after\_save won’t work. If you check for `topic.changed`, you won’t see an update to `closed`. Doesn’t work with a `before_save` either since it’s changed with a transaction and the callback isn’t called. Has anyone been able to trigger (in any capacity) on these two events? I’d rather not resort to monkey patching it in.

---

<div class="post-metadata">

### Author: ![joebuhlig](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/joebuhlig/32/193054_2.png) [@joebuhlig](https://meta.discourse.org/u/joebuhlig)
#### Post date: [February 23, 2016, 10:05pm UTC](https://meta.discourse.org/t/callback-for-topic-closed-and-topic-reopened/39989/3 "2016-02-23T22:05:49Z")

</div>

Decided to go ahead and create a PR to add the event.

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