Internal renaming of elder,leader,regular,basic to numbers

Changed internals so trust levels are referred to with

TrustLevel[1], TrustLevel[2] etc.

This gives us much better flexibility naming trust levels, these names
are meant to be controlled by various communities.
This commit is contained in:
Sam
2014-09-05 15:20:39 +10:00
parent c8d3ffb1ee
commit 59d04c0695
49 changed files with 276 additions and 274 deletions

View File

@ -92,7 +92,7 @@ describe UserProfile do
end
it 'removes the link if the user is new' do
user.trust_level = TrustLevel.levels[:newuser]
user.trust_level = TrustLevel[0]
user_profile.send(:cook)
expect(user_profile.bio_excerpt).to match_html("I love http://discourse.org")
expect(user_profile.bio_processed).to eq("<p>I love http://discourse.org</p>")
@ -102,22 +102,22 @@ describe UserProfile do
before { SiteSetting.stubs(:tl3_links_no_follow).returns(false) }
it 'includes the link without nofollow if the user is trust level 3 or higher' do
user.trust_level = TrustLevel.levels[:leader]
user.trust_level = TrustLevel[3]
user_profile.send(:cook)
expect(user_profile.bio_excerpt).to match_html("I love <a href='http://discourse.org'>http://discourse.org</a>")
expect(user_profile.bio_processed).to match_html("<p>I love <a href=\"http://discourse.org\">http://discourse.org</a></p>")
end
it 'removes nofollow from links in bio when trust level is increased' do
created_user.change_trust_level!(:leader)
created_user.change_trust_level!(TrustLevel[3])
expect(created_user.user_profile.bio_excerpt).to match_html("I love <a href='http://discourse.org'>http://discourse.org</a>")
expect(created_user.user_profile.bio_processed).to match_html("<p>I love <a href=\"http://discourse.org\">http://discourse.org</a></p>")
end
it 'adds nofollow to links in bio when trust level is decreased' do
created_user.trust_level = TrustLevel.levels[:leader]
created_user.trust_level = TrustLevel[3]
created_user.save
created_user.change_trust_level!(:regular)
created_user.change_trust_level!(TrustLevel[2])
expect(created_user.user_profile.bio_excerpt).to match_html("I love <a href='http://discourse.org' rel='nofollow'>http://discourse.org</a>")
expect(created_user.user_profile.bio_processed).to match_html("<p>I love <a href=\"http://discourse.org\" rel=\"nofollow\">http://discourse.org</a></p>")
end
@ -127,7 +127,7 @@ describe UserProfile do
before { SiteSetting.stubs(:tl3_links_no_follow).returns(true) }
it 'includes the link with nofollow if the user is trust level 3 or higher' do
user.trust_level = TrustLevel.levels[:leader]
user.trust_level = TrustLevel[3]
user_profile.send(:cook)
expect(user_profile.bio_excerpt).to match_html("I love <a href='http://discourse.org' rel='nofollow'>http://discourse.org</a>")
expect(user_profile.bio_processed).to match_html("<p>I love <a href=\"http://discourse.org\" rel=\"nofollow\">http://discourse.org</a></p>")