Feature: unconditionally consider TL0 users as "first day" users

This commit is contained in:
Jeff Wong 2018-06-20 17:25:03 -07:00
parent a41057aa6e
commit bc52bdfa12
2 changed files with 7 additions and 1 deletions

View File

@ -537,7 +537,7 @@ class User < ActiveRecord::Base
def new_user_posting_on_first_day?
!staff? &&
trust_level < TrustLevel[2] &&
(self.first_post_created_at.nil? || self.first_post_created_at >= 24.hours.ago)
(trust_level == TrustLevel[0] || self.first_post_created_at.nil? || self.first_post_created_at >= 24.hours.ago)
end
def new_user?

View File

@ -990,6 +990,12 @@ describe User do
u.user_stat.first_post_created_at = 25.hours.ago
expect(u.new_user_posting_on_first_day?).to eq(false)
end
it "considers trust level 0 users as new users unconditionally" do
u = Fabricate(:user, created_at: 28.hours.ago, trust_level: TrustLevel[0])
u.user_stat.first_post_created_at = 25.hours.ago
expect(u.new_user_posting_on_first_day?).to eq(true)
end
end
describe 'api keys' do