Commit 757c7a52916fbee75a94ee453e055e8ce02a428e
1 parent
19eb6374
Exists in
master
and in
4 other branches
Fix gravatar and ldap config
Showing
4 changed files
with
14 additions
and
16 deletions
Show diff stats
app/helpers/application_helper.rb
... | ... | @@ -34,7 +34,7 @@ module ApplicationHelper |
34 | 34 | def gravatar_icon(user_email = '', size = nil) |
35 | 35 | size = 40 if size.nil? || size <= 0 |
36 | 36 | |
37 | - if Gitlab.config.disable_gravatar? || user_email.blank? | |
37 | + if !Gitlab.config.gravatar.enabled || user_email.blank? | |
38 | 38 | 'no_avatar.png' |
39 | 39 | else |
40 | 40 | gravatar_url = request.ssl? ? Gitlab.config.gravatar.ssl_url : Gitlab.config.gravatar.plain_url | ... | ... |
app/views/profiles/show.html.haml
config/initializers/devise.rb
... | ... | @@ -205,20 +205,18 @@ Devise.setup do |config| |
205 | 205 | # manager.default_strategies(:scope => :user).unshift :some_external_strategy |
206 | 206 | # end |
207 | 207 | |
208 | - gl = Gitlab.config | |
209 | - | |
210 | - if gl.ldap_enabled? | |
208 | + if Gitlab.config.ldap.enabled | |
211 | 209 | config.omniauth :ldap, |
212 | - :host => gl.ldap['host'], | |
213 | - :base => gl.ldap['base'], | |
214 | - :uid => gl.ldap['uid'], | |
215 | - :port => gl.ldap['port'], | |
216 | - :method => gl.ldap['method'], | |
217 | - :bind_dn => gl.ldap['bind_dn'], | |
218 | - :password => gl.ldap['password'] | |
210 | + :host => Gitlab.config.ldap['host'], | |
211 | + :base => Gitlab.config.ldap['base'], | |
212 | + :uid => Gitlab.config.ldap['uid'], | |
213 | + :port => Gitlab.config.ldap['port'], | |
214 | + :method => Gitlab.config.ldap['method'], | |
215 | + :bind_dn => Gitlab.config.ldap['bind_dn'], | |
216 | + :password => Gitlab.config.ldap['password'] | |
219 | 217 | end |
220 | 218 | |
221 | - gl.omniauth_providers.each do |gl_provider| | |
222 | - config.omniauth gl_provider['name'].to_sym, gl_provider['app_id'], gl_provider['app_secret'] | |
219 | + Gitlab.config.omniauth.providers.each do |provider| | |
220 | + config.omniauth provider['name'].to_sym, provider['app_id'], provider['app_secret'] | |
223 | 221 | end |
224 | 222 | end | ... | ... |
spec/helpers/application_helper_spec.rb
... | ... | @@ -43,7 +43,7 @@ describe ApplicationHelper do |
43 | 43 | let(:user_email) { 'user@email.com' } |
44 | 44 | |
45 | 45 | it "should return a generic avatar path when Gravatar is disabled" do |
46 | - Gitlab.config.stub(:disable_gravatar?).and_return(true) | |
46 | + Gitlab.config.gravatar.stub(:enabled).and_return(false) | |
47 | 47 | gravatar_icon(user_email).should == 'no_avatar.png' |
48 | 48 | end |
49 | 49 | |
... | ... | @@ -63,7 +63,7 @@ describe ApplicationHelper do |
63 | 63 | |
64 | 64 | it "should return custom gravatar path when gravatar_url is set" do |
65 | 65 | stub!(:request).and_return(double(:ssl? => false)) |
66 | - Gitlab.config.stub(:gravatar_url).and_return('http://example.local/?s=%{size}&hash=%{hash}') | |
66 | + Gitlab.config.gravatar.stub(:plain_url).and_return('http://example.local/?s=%{size}&hash=%{hash}') | |
67 | 67 | gravatar_icon(user_email, 20).should == 'http://example.local/?s=20&hash=b58c6f14d292556214bd64909bcdb118' |
68 | 68 | end |
69 | 69 | ... | ... |