mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 06:49:14 +08:00
Feature: unconditionally consider TL0 users as "first day" users
This commit is contained in:
parent
a41057aa6e
commit
bc52bdfa12
|
@ -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?
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue
Block a user