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,7 +34,7 @@ module ApplicationHelper | ||
34 | def gravatar_icon(user_email = '', size = nil) | 34 | def gravatar_icon(user_email = '', size = nil) |
35 | size = 40 if size.nil? || size <= 0 | 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 | 'no_avatar.png' | 38 | 'no_avatar.png' |
39 | else | 39 | else |
40 | gravatar_url = request.ssl? ? Gitlab.config.gravatar.ssl_url : Gitlab.config.gravatar.plain_url | 40 | gravatar_url = request.ssl? ? Gitlab.config.gravatar.ssl_url : Gitlab.config.gravatar.plain_url |
app/views/profiles/show.html.haml
@@ -33,7 +33,7 @@ | @@ -33,7 +33,7 @@ | ||
33 | %ul | 33 | %ul |
34 | %li | 34 | %li |
35 | %p You can change your password on Account page | 35 | %p You can change your password on Account page |
36 | - -unless Gitlab.config.disable_gravatar? | 36 | + - if Gitlab.config.gravatar.enabled |
37 | %li | 37 | %li |
38 | %p You can change your avatar at #{link_to "gravatar.com", "http://gravatar.com"} | 38 | %p You can change your avatar at #{link_to "gravatar.com", "http://gravatar.com"} |
39 | 39 |
config/initializers/devise.rb
@@ -205,20 +205,18 @@ Devise.setup do |config| | @@ -205,20 +205,18 @@ Devise.setup do |config| | ||
205 | # manager.default_strategies(:scope => :user).unshift :some_external_strategy | 205 | # manager.default_strategies(:scope => :user).unshift :some_external_strategy |
206 | # end | 206 | # end |
207 | 207 | ||
208 | - gl = Gitlab.config | ||
209 | - | ||
210 | - if gl.ldap_enabled? | 208 | + if Gitlab.config.ldap.enabled |
211 | config.omniauth :ldap, | 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 | end | 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 | end | 221 | end |
224 | end | 222 | end |
spec/helpers/application_helper_spec.rb
@@ -43,7 +43,7 @@ describe ApplicationHelper do | @@ -43,7 +43,7 @@ describe ApplicationHelper do | ||
43 | let(:user_email) { 'user@email.com' } | 43 | let(:user_email) { 'user@email.com' } |
44 | 44 | ||
45 | it "should return a generic avatar path when Gravatar is disabled" do | 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 | gravatar_icon(user_email).should == 'no_avatar.png' | 47 | gravatar_icon(user_email).should == 'no_avatar.png' |
48 | end | 48 | end |
49 | 49 | ||
@@ -63,7 +63,7 @@ describe ApplicationHelper do | @@ -63,7 +63,7 @@ describe ApplicationHelper do | ||
63 | 63 | ||
64 | it "should return custom gravatar path when gravatar_url is set" do | 64 | it "should return custom gravatar path when gravatar_url is set" do |
65 | stub!(:request).and_return(double(:ssl? => false)) | 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 | gravatar_icon(user_email, 20).should == 'http://example.local/?s=20&hash=b58c6f14d292556214bd64909bcdb118' | 67 | gravatar_icon(user_email, 20).should == 'http://example.local/?s=20&hash=b58c6f14d292556214bd64909bcdb118' |
68 | end | 68 | end |
69 | 69 |