FIX: invited users and new TL1 users will see their first notification highlighted

This commit is contained in:
Neil Lalonde 2017-02-17 10:28:38 -05:00
parent 6212016688
commit 3fb50d587d
2 changed files with 10 additions and 2 deletions

View File

@ -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

View File

@ -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