diff --git a/app/models/user.rb b/app/models/user.rb index 6ce3ce4d1e0..2841be1f5d4 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -354,7 +354,7 @@ class User < ActiveRecord::Base TRACK_FIRST_NOTIFICATION_READ_DURATION = 1.week.to_i def read_first_notification? - if (trust_level > TrustLevel[0] || + if (trust_level > TrustLevel[1] || created_at < TRACK_FIRST_NOTIFICATION_READ_DURATION.seconds.ago) return true diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 75a6c32bf0b..d4bb2149b02 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -1398,10 +1398,18 @@ describe User do end end - describe 'when user is not trust level 0' do + describe 'when user is trust level 1' do it 'should return the right value' do user.update_attributes!(trust_level: TrustLevel[1]) + expect(user.read_first_notification?).to eq(false) + end + end + + describe 'when user is trust level 2' do + it 'should return the right value' do + user.update_attributes!(trust_level: TrustLevel[2]) + expect(user.read_first_notification?).to eq(true) end end