FIX: invited users and new TL1 users will see their first notification highlighted
This commit is contained in:
parent
6212016688
commit
3fb50d587d
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue