Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Tatuya Kamada
gitlab-ce
Commits
1ef1a4ae
Commit
1ef1a4ae
authored
12 years ago
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1239 from tsigo/disable_gravatar
Allow disabling Gravatars in gitlab.yml settings
parents
aa50408e
65bcc41f
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
43 additions
and
11 deletions
+43
-11
app/helpers/application_helper.rb
app/helpers/application_helper.rb
+7
-4
config/gitlab.yml.example
config/gitlab.yml.example
+6
-7
config/initializers/1_settings.rb
config/initializers/1_settings.rb
+4
-0
spec/helpers/application_helper_spec.rb
spec/helpers/application_helper_spec.rb
+26
-0
No files found.
app/helpers/application_helper.rb
View file @
1ef1a4ae
...
...
@@ -2,10 +2,13 @@ require 'digest/md5'
module
ApplicationHelper
def
gravatar_icon
(
user_email
=
''
,
size
=
40
)
return
unless
user_email
gravatar_host
=
request
.
ssl?
?
"https://secure.gravatar.com"
:
"http://www.gravatar.com"
user_email
.
strip!
"
#{
gravatar_host
}
/avatar/
#{
Digest
::
MD5
.
hexdigest
(
user_email
.
downcase
)
}
?s=
#{
size
}
&d=identicon"
if
Gitlab
.
config
.
disable_gravatar?
||
user_email
.
blank?
'no_avatar.png'
else
gravatar_prefix
=
request
.
ssl?
?
"https://secure"
:
"http://www"
user_email
.
strip!
"
#{
gravatar_prefix
}
.gravatar.com/avatar/
#{
Digest
::
MD5
.
hexdigest
(
user_email
.
downcase
)
}
?s=
#{
size
}
&d=identicon"
end
end
def
request_protocol
...
...
This diff is collapsed.
Click to expand it.
config/gitlab.yml.example
View file @
1ef1a4ae
# # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # #
# Gitlab application config file #
# # # # # # # # # # # # # # # # # #
...
...
@@ -19,14 +19,14 @@ email:
# Application specific settings
# Like default project limit for user etc
app:
default_projects_limit: 10
app:
default_projects_limit: 10
# backup_path: "/vol/backups" # default: Rails.root + backups/
# backup_keep_time: 604800 # default: 0 (forever) (in seconds)
# disable_gravatar: true # default: false - Disable user avatars from Gravatar.com
#
# 2. Advanced settings:
#
# 2. Advanced settings:
# ==========================
# Git Hosting configuration
...
...
@@ -39,7 +39,6 @@ git_host:
receive_pack: true
# port: 22
# Git settings
# Use default values unless you understand it
git:
...
...
This diff is collapsed.
Click to expand it.
config/initializers/1_settings.rb
View file @
1ef1a4ae
...
...
@@ -111,5 +111,9 @@ class Settings < Settingslogic
def
backup_keep_time
app
[
'backup_keep_time'
]
||
0
end
def
disable_gravatar?
app
[
'disable_gravatar'
]
||
false
end
end
end
This diff is collapsed.
Click to expand it.
spec/helpers/application_helper_spec.rb
0 → 100644
View file @
1ef1a4ae
require
'spec_helper'
describe
ApplicationHelper
do
describe
"gravatar_icon"
do
let
(
:user_email
)
{
'user@email.com'
}
it
"should return a generic avatar path when Gravatar is disabled"
do
Gitlab
.
config
.
stub
(
:disable_gravatar?
).
and_return
(
true
)
gravatar_icon
(
user_email
).
should
==
'no_avatar.png'
end
it
"should return a generic avatar path when email is blank"
do
gravatar_icon
(
''
).
should
==
'no_avatar.png'
end
it
"should use SSL when appropriate"
do
stub!
(
:request
).
and_return
(
double
(
:ssl?
=>
true
))
gravatar_icon
(
user_email
).
should
match
(
'https://secure.gravatar.com'
)
end
it
"should accept a custom size"
do
stub!
(
:request
).
and_return
(
double
(
:ssl?
=>
false
))
gravatar_icon
(
user_email
,
64
).
should
match
(
/\?s=64/
)
end
end
end
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment