FEATURE: Add "Reset Bump Date" action to topic admin wrench (#6246)

This commit is contained in:
Gerhard Schlager
2018-08-10 02:51:03 +02:00
committed by Sam
parent 6db623ef6b
commit b9072e8292
12 changed files with 113 additions and 1 deletions

View File

@ -1381,6 +1381,16 @@ class Topic < ActiveRecord::Base
@is_category_topic ||= Category.exists?(topic_id: self.id.to_i)
end
def reset_bumped_at
post = ordered_posts.where(
user_deleted: false,
hidden: false,
post_type: Topic.visible_post_types
).last
update!(bumped_at: post.created_at)
end
private
def update_category_topic_count_by(num)