mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: Turn off auto bumping for topics with scheduled bumps
If a topic has a timer scheduled to bump a topic it should be excluded from being auto bumped.
This commit is contained in:
@@ -532,6 +532,7 @@ class Category < ActiveRecord::Base
|
||||
topic = relation
|
||||
.visible
|
||||
.listable_topics
|
||||
.exclude_scheduled_bump_topics
|
||||
.where(category_id: self.id)
|
||||
.where('id <> ?', self.topic_id)
|
||||
.where('bumped_at < ?', 1.day.ago)
|
||||
|
||||
@@ -158,6 +158,8 @@ class Topic < ActiveRecord::Base
|
||||
|
||||
scope :created_since, lambda { |time_ago| where('topics.created_at > ?', time_ago) }
|
||||
|
||||
scope :exclude_scheduled_bump_topics, -> { where.not(id: TopicTimer.scheduled_bump_topics) }
|
||||
|
||||
scope :secured, lambda { |guardian = nil|
|
||||
ids = guardian.secure_category_ids if guardian
|
||||
|
||||
|
||||
@@ -17,6 +17,8 @@ class TopicTimer < ActiveRecord::Base
|
||||
|
||||
validate :ensure_update_will_happen
|
||||
|
||||
scope :scheduled_bump_topics, -> { where(status_type: 6, deleted_at: nil).pluck(:topic_id) }
|
||||
|
||||
before_save do
|
||||
self.created_at ||= Time.zone.now if execute_at
|
||||
self.public_type = self.public_type?
|
||||
|
||||
Reference in New Issue
Block a user