mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 19:37:55 +08:00
FIX: Suspended users should have links stripped from their profiles.
This commit is contained in:
parent
183c93904d
commit
4c9f55d1e1
|
@ -12,12 +12,12 @@ class UserProfile < ActiveRecord::Base
|
||||||
|
|
||||||
def bio_excerpt
|
def bio_excerpt
|
||||||
excerpt = PrettyText.excerpt(bio_cooked, 350)
|
excerpt = PrettyText.excerpt(bio_cooked, 350)
|
||||||
return excerpt if excerpt.blank? || user.has_trust_level?(TrustLevel[1])
|
return excerpt if excerpt.blank? || (user.has_trust_level?(TrustLevel[1]) && !user.suspended?)
|
||||||
PrettyText.strip_links(excerpt)
|
PrettyText.strip_links(excerpt)
|
||||||
end
|
end
|
||||||
|
|
||||||
def bio_processed
|
def bio_processed
|
||||||
return bio_cooked if bio_cooked.blank? || user.has_trust_level?(TrustLevel[1])
|
return bio_cooked if bio_cooked.blank? || (user.has_trust_level?(TrustLevel[1]) && !user.suspended?)
|
||||||
PrettyText.strip_links(bio_cooked)
|
PrettyText.strip_links(bio_cooked)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -103,6 +103,14 @@ describe UserProfile do
|
||||||
expect(user_profile.bio_processed).to eq("<p>I love http://discourse.org</p>")
|
expect(user_profile.bio_processed).to eq("<p>I love http://discourse.org</p>")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it 'removes the link if the user is suspended' do
|
||||||
|
user.suspended_till = 1.month.from_now
|
||||||
|
puts user.suspended?.inspect
|
||||||
|
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>")
|
||||||
|
end
|
||||||
|
|
||||||
context 'tl3_links_no_follow is false' do
|
context 'tl3_links_no_follow is false' do
|
||||||
before { SiteSetting.stubs(:tl3_links_no_follow).returns(false) }
|
before { SiteSetting.stubs(:tl3_links_no_follow).returns(false) }
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user