mirror of
https://github.com/redmine/redmine.git
synced 2025-11-10 23:36:01 +01:00
Merged r17150 to 3.3-stable (#26699).
git-svn-id: http://svn.redmine.org/redmine/branches/3.3-stable@17152 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -1278,7 +1278,13 @@ module ApplicationHelper
|
|||||||
elsif user.to_s =~ %r{<(.+?)>}
|
elsif user.to_s =~ %r{<(.+?)>}
|
||||||
email = $1
|
email = $1
|
||||||
end
|
end
|
||||||
return gravatar(email.to_s.downcase, options) unless email.blank? rescue nil
|
if email.present?
|
||||||
|
gravatar(email.to_s.downcase, options) rescue nil
|
||||||
|
else
|
||||||
|
image_tag 'anonymous.png',
|
||||||
|
GravatarHelper::DEFAULT_OPTIONS
|
||||||
|
.except(:default, :rating, :ssl).merge(options)
|
||||||
|
end
|
||||||
else
|
else
|
||||||
''
|
''
|
||||||
end
|
end
|
||||||
|
|||||||
BIN
public/images/anonymous.png
Normal file
BIN
public/images/anonymous.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.0 KiB |
@@ -1291,6 +1291,7 @@ RAW
|
|||||||
end
|
end
|
||||||
|
|
||||||
def test_avatar_enabled
|
def test_avatar_enabled
|
||||||
|
tag_for_anonymous_re = %r{src="/images/anonymous.png(\?\d+)?"}
|
||||||
with_settings :gravatar_enabled => '1' do
|
with_settings :gravatar_enabled => '1' do
|
||||||
assert avatar(User.find_by_mail('jsmith@somenet.foo')).include?(Digest::MD5.hexdigest('jsmith@somenet.foo'))
|
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'))
|
assert avatar('jsmith <jsmith@somenet.foo>').include?(Digest::MD5.hexdigest('jsmith@somenet.foo'))
|
||||||
@@ -1302,8 +1303,10 @@ RAW
|
|||||||
# The default class of the img tag should be gravatar
|
# The default class of the img tag should be gravatar
|
||||||
assert avatar('jsmith <jsmith@somenet.foo>').include?('class="gravatar"')
|
assert avatar('jsmith <jsmith@somenet.foo>').include?('class="gravatar"')
|
||||||
assert !avatar('jsmith <jsmith@somenet.foo>', :class => 'picture').include?('class="gravatar"')
|
assert !avatar('jsmith <jsmith@somenet.foo>', :class => 'picture').include?('class="gravatar"')
|
||||||
assert_nil avatar('jsmith')
|
assert_match tag_for_anonymous_re, avatar('jsmith')
|
||||||
assert_nil avatar(nil)
|
assert_match tag_for_anonymous_re, avatar(nil)
|
||||||
|
# Avatar for anonymous user
|
||||||
|
assert_match tag_for_anonymous_re, avatar(User.anonymous)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user