FIX: Don't allow silenced users to reach TL3
This commit is contained in:
parent
1bafbc8c5c
commit
4c9959f795
|
@ -26,7 +26,9 @@ class TrustLevel3Requirements
|
|||
|
||||
def requirements_met?
|
||||
return false if trust_level_locked
|
||||
!@user.suspended? &&
|
||||
|
||||
(!@user.suspended?) &&
|
||||
(!@user.silenced?) &&
|
||||
days_visited >= min_days_visited &&
|
||||
num_topics_replied_to >= min_topics_replied_to &&
|
||||
topics_viewed >= min_topics_viewed &&
|
||||
|
@ -43,7 +45,9 @@ class TrustLevel3Requirements
|
|||
|
||||
def requirements_lost?
|
||||
return false if trust_level_locked
|
||||
|
||||
@user.suspended? ||
|
||||
@user.silenced? ||
|
||||
days_visited < min_days_visited * LOW_WATER_MARK ||
|
||||
num_topics_replied_to < min_topics_replied_to * LOW_WATER_MARK ||
|
||||
topics_viewed < min_topics_viewed * LOW_WATER_MARK ||
|
||||
|
|
|
@ -357,7 +357,12 @@ describe TrustLevel3Requirements do
|
|||
end
|
||||
|
||||
it "are not met if suspended" do
|
||||
user.stubs(:suspended?).returns(true)
|
||||
user.suspended_till = 3.weeks.from_now
|
||||
expect(tl3_requirements.requirements_met?).to eq(false)
|
||||
end
|
||||
|
||||
it "are not met if silenced" do
|
||||
user.silenced_till = 3.weeks.from_now
|
||||
expect(tl3_requirements.requirements_met?).to eq(false)
|
||||
end
|
||||
|
||||
|
@ -372,7 +377,12 @@ describe TrustLevel3Requirements do
|
|||
end
|
||||
|
||||
it "are lost if suspended" do
|
||||
user.stubs(:suspended?).returns(true)
|
||||
user.suspended_till = 4.weeks.from_now
|
||||
expect(tl3_requirements.requirements_lost?).to eq(true)
|
||||
end
|
||||
|
||||
it "are lost if silenced" do
|
||||
user.silenced_till = 4.weeks.from_now
|
||||
expect(tl3_requirements.requirements_lost?).to eq(true)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue