]> source.dussan.org Git - gitea.git/commitdiff
Use identicon image for default gravatar. (#2767)
authorharry <harryzhxu@gmail.com>
Mon, 23 Oct 2017 08:50:07 +0000 (03:50 -0500)
committerBo-Yi Wu <appleboy.tw@gmail.com>
Mon, 23 Oct 2017 08:50:07 +0000 (03:50 -0500)
* Use identicon image for default gravatar.

* Fixed tests.

models/action_test.go
modules/base/tool.go
modules/base/tool_test.go

index f329195bfdc04836c1ef66612c7f5bff7a0c69d2..2bcd22cb22c9b719a02dd0e972718cb9b23cadd8 100644 (file)
@@ -146,11 +146,11 @@ func TestPushCommits_AvatarLink(t *testing.T) {
        pushCommits.Len = len(pushCommits.Commits)
 
        assert.Equal(t,
-               "https://secure.gravatar.com/avatar/ab53a2911ddf9b4817ac01ddcd3d975f",
+               "https://secure.gravatar.com/avatar/ab53a2911ddf9b4817ac01ddcd3d975f?d=identicon",
                pushCommits.AvatarLink("user2@example.com"))
 
        assert.Equal(t,
-               "https://secure.gravatar.com/avatar/19ade630b94e1e0535b3df7387434154",
+               "https://secure.gravatar.com/avatar/19ade630b94e1e0535b3df7387434154?d=identicon",
                pushCommits.AvatarLink("nonexistent@example.com"))
 }
 
index 26ced075dac5603a8559edf1867f696846bc79a1..194db772cfa22347b22e1b1792aa7a4fa30c5604 100644 (file)
@@ -211,7 +211,7 @@ func AvatarLink(email string) string {
        }
 
        if !setting.DisableGravatar {
-               return setting.GravatarSource + HashEmail(email)
+               return setting.GravatarSource + HashEmail(email) + "?d=identicon"
        }
 
        return DefaultAvatarLink()
index f3e787dd132c33db9718cb39df0ca468e543513b..44ea309f7c89ae19228804f382c74b73b22ef4e9 100644 (file)
@@ -135,7 +135,7 @@ func TestAvatarLink(t *testing.T) {
 
        setting.DisableGravatar = false
        assert.Equal(t,
-               "353cbad9b58e69c96154ad99f92bedc7",
+               "353cbad9b58e69c96154ad99f92bedc7?d=identicon",
                AvatarLink("gitea@example.com"),
        )
 }