mirror of
https://github.com/discourse/discourse.git
synced 2025-02-16 08:15:00 +00:00
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
|
TRACK_FIRST_NOTIFICATION_READ_DURATION = 1.week.to_i
|
||||||
|
|
||||||
def read_first_notification?
|
def read_first_notification?
|
||||||
if (trust_level > TrustLevel[0] ||
|
if (trust_level > TrustLevel[1] ||
|
||||||
created_at < TRACK_FIRST_NOTIFICATION_READ_DURATION.seconds.ago)
|
created_at < TRACK_FIRST_NOTIFICATION_READ_DURATION.seconds.ago)
|
||||||
|
|
||||||
return true
|
return true
|
||||||
|
@ -1398,10 +1398,18 @@ describe User do
|
|||||||
end
|
end
|
||||||
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
|
it 'should return the right value' do
|
||||||
user.update_attributes!(trust_level: TrustLevel[1])
|
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)
|
expect(user.read_first_notification?).to eq(true)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user