Reverted r10184 (#9365).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10186 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
8b12702ebe
commit
02b2a61e15
|
@ -1134,7 +1134,7 @@ module ApplicationHelper
|
|||
# +user+ can be a User or a string that will be scanned for an email address (eg. 'joe <joe@foo.bar>')
|
||||
def avatar(user, options = { })
|
||||
if Setting.gravatar_enabled?
|
||||
options.merge!({:ssl => (Setting.protocol == 'https'), :default => Setting.gravatar_default})
|
||||
options.merge!({:ssl => (request && request.ssl?), :default => Setting.gravatar_default})
|
||||
email = nil
|
||||
if user.respond_to?(:mail)
|
||||
email = user.mail
|
||||
|
|
|
@ -970,8 +970,9 @@ RAW
|
|||
end
|
||||
end
|
||||
|
||||
def test_avatar_enabled
|
||||
with_settings :gravatar_enabled => '1' do
|
||||
def test_avatar
|
||||
# turn on avatars
|
||||
Setting.gravatar_enabled = '1'
|
||||
assert avatar(User.find_by_mail('jsmith@somenet.foo')).include?(Digest::MD5.hexdigest('jsmith@somenet.foo'))
|
||||
assert avatar('jsmith <jsmith@somenet.foo>').include?(Digest::MD5.hexdigest('jsmith@somenet.foo'))
|
||||
# Default size is 50
|
||||
|
@ -984,24 +985,11 @@ RAW
|
|||
assert !avatar('jsmith <jsmith@somenet.foo>', :class => 'picture').include?('class="gravatar"')
|
||||
assert_nil avatar('jsmith')
|
||||
assert_nil avatar(nil)
|
||||
end
|
||||
end
|
||||
|
||||
def test_avatar_should_use_ssl_if_protocol_is_https
|
||||
with_settings :gravatar_enabled => '1', :protocol => 'https' do
|
||||
assert_include 'https://', avatar(User.find_by_mail('jsmith@somenet.foo'))
|
||||
end
|
||||
|
||||
with_settings :gravatar_enabled => '1', :protocol => 'http' do
|
||||
assert_include 'http://', avatar(User.find_by_mail('jsmith@somenet.foo'))
|
||||
end
|
||||
end
|
||||
|
||||
def test_avatar_disabled
|
||||
with_settings :gravatar_enabled => '0' do
|
||||
# turn off avatars
|
||||
Setting.gravatar_enabled = '0'
|
||||
assert_equal '', avatar(User.find_by_mail('jsmith@somenet.foo'))
|
||||
end
|
||||
end
|
||||
|
||||
def test_link_to_user
|
||||
user = User.find(2)
|
||||
|
|
Loading…
Reference in New Issue