aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorharry <harryzhxu@gmail.com>2017-10-23 03:50:07 -0500
committerBo-Yi Wu <appleboy.tw@gmail.com>2017-10-23 03:50:07 -0500
commit81d1e54a49cc61e64608ff2aee055110c7e4f811 (patch)
tree70b5efe8835127be80c3cbe30f42bccad0a7bdd8
parente4990ba205d56f7b6fda990d6c2d19a60b35fc56 (diff)
downloadgitea-81d1e54a49cc61e64608ff2aee055110c7e4f811.tar.gz
gitea-81d1e54a49cc61e64608ff2aee055110c7e4f811.zip
Use identicon image for default gravatar. (#2767)
* Use identicon image for default gravatar. * Fixed tests.
-rw-r--r--models/action_test.go4
-rw-r--r--modules/base/tool.go2
-rw-r--r--modules/base/tool_test.go2
3 files changed, 4 insertions, 4 deletions
diff --git a/models/action_test.go b/models/action_test.go
index f329195bfd..2bcd22cb22 100644
--- a/models/action_test.go
+++ b/models/action_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"))
}
diff --git a/modules/base/tool.go b/modules/base/tool.go
index 26ced075da..194db772cf 100644
--- a/modules/base/tool.go
+++ b/modules/base/tool.go
@@ -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()
diff --git a/modules/base/tool_test.go b/modules/base/tool_test.go
index f3e787dd13..44ea309f7c 100644
--- a/modules/base/tool_test.go
+++ b/modules/base/tool_test.go
@@ -135,7 +135,7 @@ func TestAvatarLink(t *testing.T) {
setting.DisableGravatar = false
assert.Equal(t,
- "353cbad9b58e69c96154ad99f92bedc7",
+ "353cbad9b58e69c96154ad99f92bedc7?d=identicon",
AvatarLink("gitea@example.com"),
)
}