Commit 6c2e04aadc3d6c21971e0239ff892bf0dbc7ca36
1 parent
6ee76529
Exists in
master
and in
29 other branches
gravatar: don't hardcode protocol
Showing
5 changed files
with
9 additions
and
9 deletions
Show diff stats
features/gravatar_support.feature
... | ... | @@ -20,11 +20,11 @@ Feature: Gravatar Support |
20 | 20 | Scenario: The Aurium's gravatar picture must link to his gravatar profile |
21 | 21 | # because Aurium has his picture registered at garvatar.com. |
22 | 22 | When I go to article "My Article" |
23 | - Then I should see "Aurium" linking to "http://www.gravatar.com/24a625896a07aa37fdb2352e302e96de" | |
23 | + Then I should see "Aurium" linking to "//www.gravatar.com/24a625896a07aa37fdb2352e302e96de" | |
24 | 24 | |
25 | 25 | @selenium |
26 | 26 | Scenario: The NoOne's gravatar picture must link to Gravatar homepage |
27 | 27 | # because NoOne <nobody@colivre.coop.br> has no picture registered. |
28 | 28 | When I go to article "My Article" |
29 | - Then I should see "NoOne" linking to "http://www.gravatar.com" | |
29 | + Then I should see "NoOne" linking to "//www.gravatar.com" | |
30 | 30 | ... | ... |
lib/noosfero/gravatar.rb
1 | 1 | module Noosfero::Gravatar |
2 | 2 | def gravatar_profile_image_url(email, options = {}) |
3 | - "http://www.gravatar.com/avatar/#{Digest::MD5.hexdigest(email.to_s)}?" + { | |
3 | + "//www.gravatar.com/avatar/#{Digest::MD5.hexdigest(email.to_s)}?" + { | |
4 | 4 | :only_path => false, |
5 | 5 | }.merge(options).map{|k,v| '%s=%s' % [ k,v ] }.join('&') |
6 | 6 | end |
7 | 7 | |
8 | 8 | def gravatar_profile_url(email) |
9 | - 'http://www.gravatar.com/'+ Digest::MD5.hexdigest(email.to_s) | |
9 | + '//www.gravatar.com/'+ Digest::MD5.hexdigest(email.to_s) | |
10 | 10 | end |
11 | 11 | end | ... | ... |
public/javascripts/application.js
... | ... | @@ -799,7 +799,7 @@ function original_image_dimensions(src) { |
799 | 799 | |
800 | 800 | function gravatarCommentFailback(img) { |
801 | 801 | var link = img.parentNode; |
802 | - link.href = "http://www.gravatar.com"; | |
802 | + link.href = "//www.gravatar.com"; | |
803 | 803 | img.src = img.getAttribute("data-gravatar"); |
804 | 804 | } |
805 | 805 | ... | ... |
test/unit/gravatar_test.rb
... | ... | @@ -9,18 +9,18 @@ class GravatarTest < ActiveSupport::TestCase |
9 | 9 | |
10 | 10 | should 'generate a gravatar image url' do |
11 | 11 | url = @object.gravatar_profile_image_url( 'rms@gnu.org', :size => 50, :d => 'crazyvatar' ) |
12 | - assert_match(/^http:\/\/www\.gravatar\.com\/avatar\/ed5214d4b49154ba0dc397a28ee90eb7?/, url) | |
12 | + assert_match(/^\/\/www\.gravatar\.com\/avatar\/ed5214d4b49154ba0dc397a28ee90eb7?/, url) | |
13 | 13 | assert_match(/(\?|&)d=crazyvatar(&|$)/, url) |
14 | 14 | assert_match(/(\?|&)size=50(&|$)/, url) |
15 | 15 | |
16 | 16 | url = @object.gravatar_profile_image_url( 'rms@gnu.org', :size => 50, :d => 'nicevatar' ) |
17 | - assert_match(/^http:\/\/www\.gravatar\.com\/avatar\/ed5214d4b49154ba0dc397a28ee90eb7?/, url) | |
17 | + assert_match(/^\/\/www\.gravatar\.com\/avatar\/ed5214d4b49154ba0dc397a28ee90eb7?/, url) | |
18 | 18 | assert_match(/(\?|&)d=nicevatar(&|$)/, url) |
19 | 19 | assert_match(/(\?|&)size=50(&|$)/, url) |
20 | 20 | end |
21 | 21 | |
22 | 22 | should 'generate a gravatar profile url' do |
23 | 23 | url = @object.gravatar_profile_url( 'rms@gnu.org' ) |
24 | - assert_equal('http://www.gravatar.com/ed5214d4b49154ba0dc397a28ee90eb7', url) | |
24 | + assert_equal('//www.gravatar.com/ed5214d4b49154ba0dc397a28ee90eb7', url) | |
25 | 25 | end |
26 | 26 | end | ... | ... |
test/unit/user_test.rb
... | ... | @@ -349,7 +349,7 @@ class UserTest < ActiveSupport::TestCase |
349 | 349 | assert_equal expected_hash['since_year'], person.user.data_hash['since_year'] |
350 | 350 | |
351 | 351 | # Avatar stuff |
352 | - assert_match 'http://www.gravatar.com/avatar/a0517761d5125820c28d87860bc7c02e', person.user.data_hash['avatar'] | |
352 | + assert_match '/www.gravatar.com/avatar/a0517761d5125820c28d87860bc7c02e', person.user.data_hash['avatar'] | |
353 | 353 | assert_match 'only_path=false', person.user.data_hash['avatar'] |
354 | 354 | assert_match 'd=', person.user.data_hash['avatar'] |
355 | 355 | assert_match 'size=20', person.user.data_hash['avatar'] | ... | ... |