mirror of
https://github.com/discourse/discourse.git
synced 2024-11-22 14:03:22 +08:00
DEV: Convert notify_about_flags_after to float (#16633)
Add support for `notify_about_flags_after` to be set to a float.
This commit is contained in:
parent
64f03a7d05
commit
dcc7f2a55e
|
@ -3,7 +3,7 @@
|
|||
module Jobs
|
||||
|
||||
class PendingReviewablesReminder < ::Jobs::Scheduled
|
||||
every 1.hour
|
||||
every 15.minutes
|
||||
|
||||
attr_reader :sent_reminder
|
||||
|
||||
|
@ -14,7 +14,7 @@ module Jobs
|
|||
reviewable_ids = Reviewable
|
||||
.pending
|
||||
.default_visible
|
||||
.where('latest_score < ?', SiteSetting.notify_about_flags_after.to_i.hours.ago)
|
||||
.where('latest_score < ?', SiteSetting.notify_about_flags_after.to_f.hours.ago)
|
||||
.order('id DESC')
|
||||
.pluck(:id)
|
||||
|
||||
|
|
|
@ -2237,7 +2237,9 @@ uncategorized:
|
|||
default: -1
|
||||
hidden: true
|
||||
|
||||
notify_about_flags_after: 48
|
||||
notify_about_flags_after:
|
||||
type: float
|
||||
default: 48
|
||||
|
||||
show_create_topics_notice:
|
||||
client: true
|
||||
|
|
|
@ -24,6 +24,20 @@ describe Jobs::PendingReviewablesReminder do
|
|||
end
|
||||
end
|
||||
|
||||
context "notify_about_flags_after accepts a float" do
|
||||
before { SiteSetting.notify_about_flags_after = 0.25 }
|
||||
|
||||
it "doesn't send message when flags are less than 15 minutes old" do
|
||||
create_flag(14.minutes.ago)
|
||||
expect(execute.sent_reminder).to eq(false)
|
||||
end
|
||||
|
||||
it "sends message when there is a flag older than 15 minutes" do
|
||||
create_flag(16.minutes.ago)
|
||||
expect(execute.sent_reminder).to eq(true)
|
||||
end
|
||||
end
|
||||
|
||||
context "notify_about_flags_after is 48" do
|
||||
before do
|
||||
SiteSetting.notify_about_flags_after = 48
|
||||
|
|
Loading…
Reference in New Issue
Block a user