FIX: error looking at users in admin when tl3_promotion_min_duration is set to a very high value

This commit is contained in:
Neil Lalonde
2018-10-11 15:11:40 -04:00
parent c2add85e75
commit 12f132736b
3 changed files with 16 additions and 0 deletions

View File

@ -947,6 +947,8 @@ class User < ActiveRecord::Base
end
def on_tl3_grace_period?
return true if SiteSetting.tl3_promotion_min_duration.to_i.days.ago.year < 2013
UserHistory.for(self, :auto_trust_level_change)
.where('created_at >= ?', SiteSetting.tl3_promotion_min_duration.to_i.days.ago)
.where(previous_value: TrustLevel[2].to_s)