Callback for topic_closed and topic_reopened

(Joe Buhlig) #1

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?

(Joe Buhlig) #2

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.

(Joe Buhlig) #3

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