Use identicon image for default gravatar. (#2767)

* Use identicon image for default gravatar.

* Fixed tests.
pull/2765/head^2
harry 7 years ago committed by Bo-Yi Wu
parent e4990ba205
commit 81d1e54a49
  1. 4
      models/action_test.go
  2. 2
      modules/base/tool.go
  3. 2
      modules/base/tool_test.go

@ -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"))
}

@ -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()

@ -135,7 +135,7 @@ func TestAvatarLink(t *testing.T) {
setting.DisableGravatar = false
assert.Equal(t,
"353cbad9b58e69c96154ad99f92bedc7",
"353cbad9b58e69c96154ad99f92bedc7?d=identicon",
AvatarLink("gitea@example.com"),
)
}

Loading…
Cancel
Save