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
Léo-Paul Géneau
gitlab-ce
Commits
eaada9d7
Commit
eaada9d7
authored
Feb 02, 2018
by
Mario de la Ossa
Committed by
Sean McGivern
Feb 02, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use Gitlab::UserSettings directly as a singleton instead of including/extending it
parent
8fa2932d
Changes
96
Show whitespace changes
Inline
Side-by-side
Showing
96 changed files
with
247 additions
and
324 deletions
+247
-324
app/controllers/admin/cohorts_controller.rb
app/controllers/admin/cohorts_controller.rb
+1
-1
app/controllers/application_controller.rb
app/controllers/application_controller.rb
+11
-12
app/controllers/concerns/enforces_two_factor_authentication.rb
...ontrollers/concerns/enforces_two_factor_authentication.rb
+3
-3
app/controllers/concerns/requires_whitelisted_monitoring_client.rb
...ollers/concerns/requires_whitelisted_monitoring_client.rb
+1
-3
app/controllers/invites_controller.rb
app/controllers/invites_controller.rb
+1
-1
app/controllers/koding_controller.rb
app/controllers/koding_controller.rb
+1
-1
app/controllers/oauth/applications_controller.rb
app/controllers/oauth/applications_controller.rb
+1
-2
app/controllers/omniauth_callbacks_controller.rb
app/controllers/omniauth_callbacks_controller.rb
+1
-1
app/controllers/passwords_controller.rb
app/controllers/passwords_controller.rb
+1
-3
app/controllers/projects_controller.rb
app/controllers/projects_controller.rb
+1
-1
app/controllers/root_controller.rb
app/controllers/root_controller.rb
+3
-3
app/helpers/application_settings_helper.rb
app/helpers/application_settings_helper.rb
+6
-8
app/helpers/auth_helper.rb
app/helpers/auth_helper.rb
+1
-3
app/helpers/projects_helper.rb
app/helpers/projects_helper.rb
+4
-6
app/helpers/version_check_helper.rb
app/helpers/version_check_helper.rb
+1
-1
app/helpers/visibility_level_helper.rb
app/helpers/visibility_level_helper.rb
+2
-2
app/mailers/abuse_report_mailer.rb
app/mailers/abuse_report_mailer.rb
+2
-4
app/mailers/base_mailer.rb
app/mailers/base_mailer.rb
+1
-3
app/models/clusters/platforms/kubernetes.rb
app/models/clusters/platforms/kubernetes.rb
+1
-2
app/models/issue_assignee.rb
app/models/issue_assignee.rb
+0
-2
app/models/key.rb
app/models/key.rb
+2
-3
app/models/namespace.rb
app/models/namespace.rb
+0
-1
app/models/note.rb
app/models/note.rb
+1
-2
app/models/project.rb
app/models/project.rb
+8
-10
app/models/project_services/kubernetes_service.rb
app/models/project_services/kubernetes_service.rb
+1
-2
app/models/protected_branch.rb
app/models/protected_branch.rb
+2
-4
app/models/snippet.rb
app/models/snippet.rb
+1
-3
app/models/user.rb
app/models/user.rb
+8
-10
app/services/akismet_service.rb
app/services/akismet_service.rb
+2
-4
app/services/auth/container_registry_authentication_service.rb
...ervices/auth/container_registry_authentication_service.rb
+1
-3
app/services/base_service.rb
app/services/base_service.rb
+0
-1
app/services/ci/register_job_service.rb
app/services/ci/register_job_service.rb
+0
-2
app/services/git_push_service.rb
app/services/git_push_service.rb
+0
-1
app/services/gravatar_service.rb
app/services/gravatar_service.rb
+1
-3
app/services/projects/housekeeping_service.rb
app/services/projects/housekeeping_service.rb
+4
-6
app/services/projects/update_pages_service.rb
app/services/projects/update_pages_service.rb
+1
-3
app/services/projects/update_service.rb
app/services/projects/update_service.rb
+1
-1
app/services/submit_usage_ping_service.rb
app/services/submit_usage_ping_service.rb
+1
-3
app/services/upload_service.rb
app/services/upload_service.rb
+1
-3
app/services/users/build_service.rb
app/services/users/build_service.rb
+2
-4
app/views/admin/conversational_development_index/show.html.haml
...ews/admin/conversational_development_index/show.html.haml
+1
-1
app/views/admin/dashboard/index.html.haml
app/views/admin/dashboard/index.html.haml
+1
-1
app/views/admin/health_check/show.html.haml
app/views/admin/health_check/show.html.haml
+4
-4
app/views/admin/runners/index.html.haml
app/views/admin/runners/index.html.haml
+1
-1
app/views/devise/confirmations/almost_there.haml
app/views/devise/confirmations/almost_there.haml
+2
-2
app/views/help/index.html.haml
app/views/help/index.html.haml
+4
-4
app/views/koding/index.html.haml
app/views/koding/index.html.haml
+1
-1
app/views/layouts/_head.html.haml
app/views/layouts/_head.html.haml
+1
-1
app/views/layouts/devise.html.haml
app/views/layouts/devise.html.haml
+2
-2
app/views/layouts/nav/sidebar/_profile.html.haml
app/views/layouts/nav/sidebar/_profile.html.haml
+1
-1
app/views/notify/_note_email.html.haml
app/views/notify/_note_email.html.haml
+1
-1
app/views/notify/_note_email.text.erb
app/views/notify/_note_email.text.erb
+1
-1
app/views/notify/new_issue_email.html.haml
app/views/notify/new_issue_email.html.haml
+1
-1
app/views/notify/new_merge_request_email.html.haml
app/views/notify/new_merge_request_email.html.haml
+1
-1
app/views/notify/new_user_email.html.haml
app/views/notify/new_user_email.html.haml
+1
-1
app/views/projects/_export.html.haml
app/views/projects/_export.html.haml
+1
-1
app/views/projects/commits/_commit.html.haml
app/views/projects/commits/_commit.html.haml
+1
-1
app/views/projects/pipelines_settings/_show.html.haml
app/views/projects/pipelines_settings/_show.html.haml
+1
-1
app/views/projects/runners/_shared_runners.html.haml
app/views/projects/runners/_shared_runners.html.haml
+2
-2
app/workers/git_garbage_collect_worker.rb
app/workers/git_garbage_collect_worker.rb
+1
-2
lib/api/helpers/runner.rb
lib/api/helpers/runner.rb
+2
-4
lib/email_template_interceptor.rb
lib/email_template_interceptor.rb
+1
-3
lib/gitlab/asciidoc.rb
lib/gitlab/asciidoc.rb
+3
-5
lib/gitlab/auth.rb
lib/gitlab/auth.rb
+2
-4
lib/gitlab/current_settings.rb
lib/gitlab/current_settings.rb
+57
-51
lib/gitlab/gon_helper.rb
lib/gitlab/gon_helper.rb
+2
-3
lib/gitlab/legacy_github_import/project_creator.rb
lib/gitlab/legacy_github_import/project_creator.rb
+1
-3
lib/gitlab/metrics/prometheus.rb
lib/gitlab/metrics/prometheus.rb
+1
-2
lib/gitlab/middleware/go.rb
lib/gitlab/middleware/go.rb
+1
-2
lib/gitlab/performance_bar.rb
lib/gitlab/performance_bar.rb
+1
-3
lib/gitlab/polling_interval.rb
lib/gitlab/polling_interval.rb
+2
-4
lib/gitlab/protocol_access.rb
lib/gitlab/protocol_access.rb
+2
-4
lib/gitlab/recaptcha.rb
lib/gitlab/recaptcha.rb
+4
-6
lib/gitlab/sentry.rb
lib/gitlab/sentry.rb
+1
-3
lib/gitlab/usage_data.rb
lib/gitlab/usage_data.rb
+3
-5
lib/gitlab/visibility_level.rb
lib/gitlab/visibility_level.rb
+2
-3
spec/controllers/health_check_controller_spec.rb
spec/controllers/health_check_controller_spec.rb
+1
-1
spec/controllers/health_controller_spec.rb
spec/controllers/health_controller_spec.rb
+1
-1
spec/controllers/oauth/applications_controller_spec.rb
spec/controllers/oauth/applications_controller_spec.rb
+1
-2
spec/features/admin/admin_health_check_spec.rb
spec/features/admin/admin_health_check_spec.rb
+2
-2
spec/features/admin/admin_runners_spec.rb
spec/features/admin/admin_runners_spec.rb
+1
-1
spec/features/admin/admin_settings_spec.rb
spec/features/admin/admin_settings_spec.rb
+6
-6
spec/features/issues/spam_issues_spec.rb
spec/features/issues/spam_issues_spec.rb
+1
-1
spec/helpers/version_check_helper_spec.rb
spec/helpers/version_check_helper_spec.rb
+2
-2
spec/lib/gitlab/current_settings_spec.rb
spec/lib/gitlab/current_settings_spec.rb
+28
-12
spec/lib/gitlab/metrics_spec.rb
spec/lib/gitlab/metrics_spec.rb
+1
-1
spec/lib/gitlab/usage_data_spec.rb
spec/lib/gitlab/usage_data_spec.rb
+3
-3
spec/models/key_spec.rb
spec/models/key_spec.rb
+0
-7
spec/models/note_spec.rb
spec/models/note_spec.rb
+0
-2
spec/models/project_spec.rb
spec/models/project_spec.rb
+0
-1
spec/models/user_spec.rb
spec/models/user_spec.rb
+2
-4
spec/requests/api/projects_spec.rb
spec/requests/api/projects_spec.rb
+0
-2
spec/requests/api/v3/projects_spec.rb
spec/requests/api/v3/projects_spec.rb
+0
-2
spec/support/stored_repositories.rb
spec/support/stored_repositories.rb
+1
-3
spec/support/stub_env.rb
spec/support/stub_env.rb
+0
-2
spec/support/unique_ip_check_shared_examples.rb
spec/support/unique_ip_check_shared_examples.rb
+3
-3
No files found.
app/controllers/admin/cohorts_controller.rb
View file @
eaada9d7
class
Admin::CohortsController
<
Admin
::
ApplicationController
class
Admin::CohortsController
<
Admin
::
ApplicationController
def
index
def
index
if
current_application_s
ettings
.
usage_ping_enabled
if
Gitlab
::
CurrentS
ettings
.
usage_ping_enabled
cohorts_results
=
Rails
.
cache
.
fetch
(
'cohorts'
,
expires_in:
1
.
day
)
do
cohorts_results
=
Rails
.
cache
.
fetch
(
'cohorts'
,
expires_in:
1
.
day
)
do
CohortsService
.
new
.
execute
CohortsService
.
new
.
execute
end
end
...
...
app/controllers/application_controller.rb
View file @
eaada9d7
...
@@ -2,7 +2,6 @@ require 'gon'
...
@@ -2,7 +2,6 @@ require 'gon'
require
'fogbugz'
require
'fogbugz'
class
ApplicationController
<
ActionController
::
Base
class
ApplicationController
<
ActionController
::
Base
include
Gitlab
::
CurrentSettings
include
Gitlab
::
GonHelper
include
Gitlab
::
GonHelper
include
GitlabRoutingHelper
include
GitlabRoutingHelper
include
PageLayoutHelper
include
PageLayoutHelper
...
@@ -28,7 +27,7 @@ class ApplicationController < ActionController::Base
...
@@ -28,7 +27,7 @@ class ApplicationController < ActionController::Base
protect_from_forgery
with: :exception
protect_from_forgery
with: :exception
helper_method
:can?
,
:current_application_settings
helper_method
:can?
helper_method
:import_sources_enabled?
,
:github_import_enabled?
,
:gitea_import_enabled?
,
:github_import_configured?
,
:gitlab_import_enabled?
,
:gitlab_import_configured?
,
:bitbucket_import_enabled?
,
:bitbucket_import_configured?
,
:google_code_import_enabled?
,
:fogbugz_import_enabled?
,
:git_import_enabled?
,
:gitlab_project_import_enabled?
helper_method
:import_sources_enabled?
,
:github_import_enabled?
,
:gitea_import_enabled?
,
:github_import_configured?
,
:gitlab_import_enabled?
,
:gitlab_import_configured?
,
:bitbucket_import_enabled?
,
:bitbucket_import_configured?
,
:google_code_import_enabled?
,
:fogbugz_import_enabled?
,
:git_import_enabled?
,
:gitlab_project_import_enabled?
rescue_from
Encoding
::
CompatibilityError
do
|
exception
|
rescue_from
Encoding
::
CompatibilityError
do
|
exception
|
...
@@ -120,7 +119,7 @@ class ApplicationController < ActionController::Base
...
@@ -120,7 +119,7 @@ class ApplicationController < ActionController::Base
end
end
def
after_sign_out_path_for
(
resource
)
def
after_sign_out_path_for
(
resource
)
current_application_s
ettings
.
after_sign_out_path
.
presence
||
new_user_session_path
Gitlab
::
CurrentS
ettings
.
after_sign_out_path
.
presence
||
new_user_session_path
end
end
def
can?
(
object
,
action
,
subject
=
:global
)
def
can?
(
object
,
action
,
subject
=
:global
)
...
@@ -268,15 +267,15 @@ class ApplicationController < ActionController::Base
...
@@ -268,15 +267,15 @@ class ApplicationController < ActionController::Base
end
end
def
import_sources_enabled?
def
import_sources_enabled?
!
current_application_s
ettings
.
import_sources
.
empty?
!
Gitlab
::
CurrentS
ettings
.
import_sources
.
empty?
end
end
def
github_import_enabled?
def
github_import_enabled?
current_application_s
ettings
.
import_sources
.
include?
(
'github'
)
Gitlab
::
CurrentS
ettings
.
import_sources
.
include?
(
'github'
)
end
end
def
gitea_import_enabled?
def
gitea_import_enabled?
current_application_s
ettings
.
import_sources
.
include?
(
'gitea'
)
Gitlab
::
CurrentS
ettings
.
import_sources
.
include?
(
'gitea'
)
end
end
def
github_import_configured?
def
github_import_configured?
...
@@ -284,7 +283,7 @@ class ApplicationController < ActionController::Base
...
@@ -284,7 +283,7 @@ class ApplicationController < ActionController::Base
end
end
def
gitlab_import_enabled?
def
gitlab_import_enabled?
request
.
host
!=
'gitlab.com'
&&
current_application_s
ettings
.
import_sources
.
include?
(
'gitlab'
)
request
.
host
!=
'gitlab.com'
&&
Gitlab
::
CurrentS
ettings
.
import_sources
.
include?
(
'gitlab'
)
end
end
def
gitlab_import_configured?
def
gitlab_import_configured?
...
@@ -292,7 +291,7 @@ class ApplicationController < ActionController::Base
...
@@ -292,7 +291,7 @@ class ApplicationController < ActionController::Base
end
end
def
bitbucket_import_enabled?
def
bitbucket_import_enabled?
current_application_s
ettings
.
import_sources
.
include?
(
'bitbucket'
)
Gitlab
::
CurrentS
ettings
.
import_sources
.
include?
(
'bitbucket'
)
end
end
def
bitbucket_import_configured?
def
bitbucket_import_configured?
...
@@ -300,19 +299,19 @@ class ApplicationController < ActionController::Base
...
@@ -300,19 +299,19 @@ class ApplicationController < ActionController::Base
end
end
def
google_code_import_enabled?
def
google_code_import_enabled?
current_application_s
ettings
.
import_sources
.
include?
(
'google_code'
)
Gitlab
::
CurrentS
ettings
.
import_sources
.
include?
(
'google_code'
)
end
end
def
fogbugz_import_enabled?
def
fogbugz_import_enabled?
current_application_s
ettings
.
import_sources
.
include?
(
'fogbugz'
)
Gitlab
::
CurrentS
ettings
.
import_sources
.
include?
(
'fogbugz'
)
end
end
def
git_import_enabled?
def
git_import_enabled?
current_application_s
ettings
.
import_sources
.
include?
(
'git'
)
Gitlab
::
CurrentS
ettings
.
import_sources
.
include?
(
'git'
)
end
end
def
gitlab_project_import_enabled?
def
gitlab_project_import_enabled?
current_application_s
ettings
.
import_sources
.
include?
(
'gitlab_project'
)
Gitlab
::
CurrentS
ettings
.
import_sources
.
include?
(
'gitlab_project'
)
end
end
# U2F (universal 2nd factor) devices need a unique identifier for the application
# U2F (universal 2nd factor) devices need a unique identifier for the application
...
...
app/controllers/concerns/enforces_two_factor_authentication.rb
View file @
eaada9d7
...
@@ -20,13 +20,13 @@ module EnforcesTwoFactorAuthentication
...
@@ -20,13 +20,13 @@ module EnforcesTwoFactorAuthentication
end
end
def
two_factor_authentication_required?
def
two_factor_authentication_required?
current_application_s
ettings
.
require_two_factor_authentication?
||
Gitlab
::
CurrentS
ettings
.
require_two_factor_authentication?
||
current_user
.
try
(
:require_two_factor_authentication_from_group?
)
current_user
.
try
(
:require_two_factor_authentication_from_group?
)
end
end
def
two_factor_authentication_reason
(
global:
->
{},
group:
->
{})
def
two_factor_authentication_reason
(
global:
->
{},
group:
->
{})
if
two_factor_authentication_required?
if
two_factor_authentication_required?
if
current_application_s
ettings
.
require_two_factor_authentication?
if
Gitlab
::
CurrentS
ettings
.
require_two_factor_authentication?
global
.
call
global
.
call
else
else
groups
=
current_user
.
expanded_groups_requiring_two_factor_authentication
.
reorder
(
name: :asc
)
groups
=
current_user
.
expanded_groups_requiring_two_factor_authentication
.
reorder
(
name: :asc
)
...
@@ -36,7 +36,7 @@ module EnforcesTwoFactorAuthentication
...
@@ -36,7 +36,7 @@ module EnforcesTwoFactorAuthentication
end
end
def
two_factor_grace_period
def
two_factor_grace_period
periods
=
[
current_application_s
ettings
.
two_factor_grace_period
]
periods
=
[
Gitlab
::
CurrentS
ettings
.
two_factor_grace_period
]
periods
<<
current_user
.
two_factor_grace_period
if
current_user
.
try
(
:require_two_factor_authentication_from_group?
)
periods
<<
current_user
.
two_factor_grace_period
if
current_user
.
try
(
:require_two_factor_authentication_from_group?
)
periods
.
min
periods
.
min
end
end
...
...
app/controllers/concerns/requires_whitelisted_monitoring_client.rb
View file @
eaada9d7
module
RequiresWhitelistedMonitoringClient
module
RequiresWhitelistedMonitoringClient
extend
ActiveSupport
::
Concern
extend
ActiveSupport
::
Concern
include
Gitlab
::
CurrentSettings
included
do
included
do
before_action
:validate_ip_whitelisted_or_valid_token!
before_action
:validate_ip_whitelisted_or_valid_token!
end
end
...
@@ -26,7 +24,7 @@ module RequiresWhitelistedMonitoringClient
...
@@ -26,7 +24,7 @@ module RequiresWhitelistedMonitoringClient
token
.
present?
&&
token
.
present?
&&
ActiveSupport
::
SecurityUtils
.
variable_size_secure_compare
(
ActiveSupport
::
SecurityUtils
.
variable_size_secure_compare
(
token
,
token
,
current_application_s
ettings
.
health_check_access_token
Gitlab
::
CurrentS
ettings
.
health_check_access_token
)
)
end
end
...
...
app/controllers/invites_controller.rb
View file @
eaada9d7
...
@@ -51,7 +51,7 @@ class InvitesController < ApplicationController
...
@@ -51,7 +51,7 @@ class InvitesController < ApplicationController
return
if
current_user
return
if
current_user
notice
=
"To accept this invitation, sign in"
notice
=
"To accept this invitation, sign in"
notice
<<
" or create an account"
if
current_application_s
ettings
.
allow_signup?
notice
<<
" or create an account"
if
Gitlab
::
CurrentS
ettings
.
allow_signup?
notice
<<
"."
notice
<<
"."
store_location_for
:user
,
request
.
fullpath
store_location_for
:user
,
request
.
fullpath
...
...
app/controllers/koding_controller.rb
View file @
eaada9d7
...
@@ -10,6 +10,6 @@ class KodingController < ApplicationController
...
@@ -10,6 +10,6 @@ class KodingController < ApplicationController
private
private
def
check_integration!
def
check_integration!
render_404
unless
current_application_s
ettings
.
koding_enabled?
render_404
unless
Gitlab
::
CurrentS
ettings
.
koding_enabled?
end
end
end
end
app/controllers/oauth/applications_controller.rb
View file @
eaada9d7
class
Oauth::ApplicationsController
<
Doorkeeper
::
ApplicationsController
class
Oauth::ApplicationsController
<
Doorkeeper
::
ApplicationsController
include
Gitlab
::
CurrentSettings
include
Gitlab
::
GonHelper
include
Gitlab
::
GonHelper
include
PageLayoutHelper
include
PageLayoutHelper
include
OauthApplications
include
OauthApplications
...
@@ -31,7 +30,7 @@ class Oauth::ApplicationsController < Doorkeeper::ApplicationsController
...
@@ -31,7 +30,7 @@ class Oauth::ApplicationsController < Doorkeeper::ApplicationsController
private
private
def
verify_user_oauth_applications_enabled
def
verify_user_oauth_applications_enabled
return
if
current_application_s
ettings
.
user_oauth_applications?
return
if
Gitlab
::
CurrentS
ettings
.
user_oauth_applications?
redirect_to
profile_path
redirect_to
profile_path
end
end
...
...
app/controllers/omniauth_callbacks_controller.rb
View file @
eaada9d7
...
@@ -145,7 +145,7 @@ class OmniauthCallbacksController < Devise::OmniauthCallbacksController
...
@@ -145,7 +145,7 @@ class OmniauthCallbacksController < Devise::OmniauthCallbacksController
label
=
Gitlab
::
OAuth
::
Provider
.
label_for
(
oauth
[
'provider'
])
label
=
Gitlab
::
OAuth
::
Provider
.
label_for
(
oauth
[
'provider'
])
message
=
"Signing in using your
#{
label
}
account without a pre-existing GitLab account is not allowed."
message
=
"Signing in using your
#{
label
}
account without a pre-existing GitLab account is not allowed."
if
current_application_s
ettings
.
allow_signup?
if
Gitlab
::
CurrentS
ettings
.
allow_signup?
message
<<
" Create a GitLab account first, and then connect it to your
#{
label
}
account."
message
<<
" Create a GitLab account first, and then connect it to your
#{
label
}
account."
end
end
...
...
app/controllers/passwords_controller.rb
View file @
eaada9d7
class
PasswordsController
<
Devise
::
PasswordsController
class
PasswordsController
<
Devise
::
PasswordsController
include
Gitlab
::
CurrentSettings
skip_before_action
:require_no_authentication
,
only:
[
:edit
,
:update
]
skip_before_action
:require_no_authentication
,
only:
[
:edit
,
:update
]
before_action
:resource_from_email
,
only:
[
:create
]
before_action
:resource_from_email
,
only:
[
:create
]
...
@@ -46,7 +44,7 @@ class PasswordsController < Devise::PasswordsController
...
@@ -46,7 +44,7 @@ class PasswordsController < Devise::PasswordsController
if
resource
if
resource
return
if
resource
.
allow_password_authentication?
return
if
resource
.
allow_password_authentication?
else
else
return
if
current_application_s
ettings
.
password_authentication_enabled?
return
if
Gitlab
::
CurrentS
ettings
.
password_authentication_enabled?
end
end
redirect_to
after_sending_reset_password_instructions_path_for
(
resource_name
),
redirect_to
after_sending_reset_password_instructions_path_for
(
resource_name
),
...
...
app/controllers/projects_controller.rb
View file @
eaada9d7
...
@@ -394,7 +394,7 @@ class ProjectsController < Projects::ApplicationController
...
@@ -394,7 +394,7 @@ class ProjectsController < Projects::ApplicationController
end
end
def
project_export_enabled
def
project_export_enabled
render_404
unless
current_application_s
ettings
.
project_export_enabled?
render_404
unless
Gitlab
::
CurrentS
ettings
.
project_export_enabled?
end
end
def
redirect_git_extension
def
redirect_git_extension
...
...
app/controllers/root_controller.rb
View file @
eaada9d7
...
@@ -23,7 +23,7 @@ class RootController < Dashboard::ProjectsController
...
@@ -23,7 +23,7 @@ class RootController < Dashboard::ProjectsController
def
redirect_unlogged_user
def
redirect_unlogged_user
if
redirect_to_home_page_url?
if
redirect_to_home_page_url?
redirect_to
(
current_application_s
ettings
.
home_page_url
)
redirect_to
(
Gitlab
::
CurrentS
ettings
.
home_page_url
)
else
else
redirect_to
(
new_user_session_path
)
redirect_to
(
new_user_session_path
)
end
end
...
@@ -48,9 +48,9 @@ class RootController < Dashboard::ProjectsController
...
@@ -48,9 +48,9 @@ class RootController < Dashboard::ProjectsController
def
redirect_to_home_page_url?
def
redirect_to_home_page_url?
# If user is not signed-in and tries to access root_path - redirect him to landing page
# If user is not signed-in and tries to access root_path - redirect him to landing page
# Don't redirect to the default URL to prevent endless redirections
# Don't redirect to the default URL to prevent endless redirections
return
false
unless
current_application_s
ettings
.
home_page_url
.
present?
return
false
unless
Gitlab
::
CurrentS
ettings
.
home_page_url
.
present?
home_page_url
=
current_application_s
ettings
.
home_page_url
.
chomp
(
'/'
)
home_page_url
=
Gitlab
::
CurrentS
ettings
.
home_page_url
.
chomp
(
'/'
)
root_urls
=
[
Gitlab
.
config
.
gitlab
[
'url'
].
chomp
(
'/'
),
root_url
.
chomp
(
'/'
)]
root_urls
=
[
Gitlab
.
config
.
gitlab
[
'url'
].
chomp
(
'/'
),
root_url
.
chomp
(
'/'
)]
root_urls
.
exclude?
(
home_page_url
)
root_urls
.
exclude?
(
home_page_url
)
...
...
app/helpers/application_settings_helper.rb
View file @
eaada9d7
module
ApplicationSettingsHelper
module
ApplicationSettingsHelper
extend
self
extend
self
include
Gitlab
::
CurrentSettings
delegate
:allow_signup?
,
delegate
:allow_signup?
,
:gravatar_enabled?
,
:gravatar_enabled?
,
:password_authentication_enabled_for_web?
,
:password_authentication_enabled_for_web?
,
:akismet_enabled?
,
:akismet_enabled?
,
:koding_enabled?
,
:koding_enabled?
,
to: :
current_application_settings
to: :
'Gitlab::CurrentSettings.current_application_settings'
def
user_oauth_applications?
def
user_oauth_applications?
current_application_s
ettings
.
user_oauth_applications
Gitlab
::
CurrentS
ettings
.
user_oauth_applications
end
end
def
allowed_protocols_present?
def
allowed_protocols_present?
current_application_s
ettings
.
enabled_git_access_protocol
.
present?
Gitlab
::
CurrentS
ettings
.
enabled_git_access_protocol
.
present?
end
end
def
enabled_protocol
def
enabled_protocol
case
current_application_s
ettings
.
enabled_git_access_protocol
case
Gitlab
::
CurrentS
ettings
.
enabled_git_access_protocol
when
'http'
when
'http'
gitlab_config
.
protocol
gitlab_config
.
protocol
when
'ssh'
when
'ssh'
...
@@ -57,7 +55,7 @@ module ApplicationSettingsHelper
...
@@ -57,7 +55,7 @@ module ApplicationSettingsHelper
# toggle button effect.
# toggle button effect.
def
import_sources_checkboxes
(
help_block_id
)
def
import_sources_checkboxes
(
help_block_id
)
Gitlab
::
ImportSources
.
options
.
map
do
|
name
,
source
|
Gitlab
::
ImportSources
.
options
.
map
do
|
name
,
source
|
checked
=
current_application_s
ettings
.
import_sources
.
include?
(
source
)
checked
=
Gitlab
::
CurrentS
ettings
.
import_sources
.
include?
(
source
)
css_class
=
checked
?
'active'
:
''
css_class
=
checked
?
'active'
:
''
checkbox_name
=
'application_setting[import_sources][]'
checkbox_name
=
'application_setting[import_sources][]'
...
@@ -72,7 +70,7 @@ module ApplicationSettingsHelper
...
@@ -72,7 +70,7 @@ module ApplicationSettingsHelper
def
oauth_providers_checkboxes
def
oauth_providers_checkboxes
button_based_providers
.
map
do
|
source
|
button_based_providers
.
map
do
|
source
|
disabled
=
current_application_s
ettings
.
disabled_oauth_sign_in_sources
.
include?
(
source
.
to_s
)
disabled
=
Gitlab
::
CurrentS
ettings
.
disabled_oauth_sign_in_sources
.
include?
(
source
.
to_s
)
css_class
=
'btn'
css_class
=
'btn'
css_class
<<
' active'
unless
disabled
css_class
<<
' active'
unless
disabled
checkbox_name
=
'application_setting[enabled_oauth_sign_in_sources][]'
checkbox_name
=
'application_setting[enabled_oauth_sign_in_sources][]'
...
...
app/helpers/auth_helper.rb
View file @
eaada9d7
module
AuthHelper
module
AuthHelper
include
Gitlab
::
CurrentSettings
PROVIDERS_WITH_ICONS
=
%w(twitter github gitlab bitbucket google_oauth2 facebook azure_oauth2 authentiq)
.
freeze
PROVIDERS_WITH_ICONS
=
%w(twitter github gitlab bitbucket google_oauth2 facebook azure_oauth2 authentiq)
.
freeze
FORM_BASED_PROVIDERS
=
[
/\Aldap/
,
'crowd'
].
freeze
FORM_BASED_PROVIDERS
=
[
/\Aldap/
,
'crowd'
].
freeze
...
@@ -41,7 +39,7 @@ module AuthHelper
...
@@ -41,7 +39,7 @@ module AuthHelper
end
end
def
enabled_button_based_providers
def
enabled_button_based_providers
disabled_providers
=
current_application_s
ettings
.
disabled_oauth_sign_in_sources
||
[]
disabled_providers
=
Gitlab
::
CurrentS
ettings
.
disabled_oauth_sign_in_sources
||
[]
button_based_providers
.
map
(
&
:to_s
)
-
disabled_providers
button_based_providers
.
map
(
&
:to_s
)
-
disabled_providers
end
end
...
...
app/helpers/projects_helper.rb
View file @
eaada9d7
module
ProjectsHelper
module
ProjectsHelper
include
Gitlab
::
CurrentSettings
def
link_to_project
(
project
)
def
link_to_project
(
project
)
link_to
[
project
.
namespace
.
becomes
(
Namespace
),
project
],
title:
h
(
project
.
name
)
do
link_to
[
project
.
namespace
.
becomes
(
Namespace
),
project
],
title:
h
(
project
.
name
)
do
title
=
content_tag
(
:span
,
project
.
name
,
class:
'project-name'
)
title
=
content_tag
(
:span
,
project
.
name
,
class:
'project-name'
)
...
@@ -214,7 +212,7 @@ module ProjectsHelper
...
@@ -214,7 +212,7 @@ module ProjectsHelper
project
.
cache_key
,
project
.
cache_key
,
controller
.
controller_name
,
controller
.
controller_name
,
controller
.
action_name
,
controller
.
action_name
,
current_application_s
ettings
.
cache_key
,
Gitlab
::
CurrentS
ettings
.
cache_key
,
'v2.5'
'v2.5'
]
]
...
@@ -447,10 +445,10 @@ module ProjectsHelper
...
@@ -447,10 +445,10 @@ module ProjectsHelper
path
=
"
#{
import_path
}
?repo=
#{
repo
}
&branch=
#{
branch
}
&sha=
#{
sha
}
"
path
=
"
#{
import_path
}
?repo=
#{
repo
}
&branch=
#{
branch
}
&sha=
#{
sha
}
"
return
URI
.
join
(
current_application_s
ettings
.
koding_url
,
path
).
to_s
return
URI
.
join
(
Gitlab
::
CurrentS
ettings
.
koding_url
,
path
).
to_s
end
end
current_application_s
ettings
.
koding_url
Gitlab
::
CurrentS
ettings
.
koding_url
end
end
def
contribution_guide_path
(
project
)
def
contribution_guide_path
(
project
)
...
@@ -559,7 +557,7 @@ module ProjectsHelper
...
@@ -559,7 +557,7 @@ module ProjectsHelper
def
restricted_levels
def
restricted_levels
return
[]
if
current_user
.
admin?
return
[]
if
current_user
.
admin?
current_application_s
ettings
.
restricted_visibility_levels
||
[]
Gitlab
::
CurrentS
ettings
.
restricted_visibility_levels
||
[]
end
end
def
project_permissions_settings
(
project
)
def
project_permissions_settings
(
project
)
...
...
app/helpers/version_check_helper.rb
View file @
eaada9d7
module
VersionCheckHelper
module
VersionCheckHelper
def
version_status_badge
def
version_status_badge
if
Rails
.
env
.
production?
&&
current_application_s
ettings
.
version_check_enabled
if
Rails
.
env
.
production?
&&
Gitlab
::
CurrentS
ettings
.
version_check_enabled
image_url
=
VersionCheck
.
new
.
url
image_url
=
VersionCheck
.
new
.
url
image_tag
image_url
,
class:
'js-version-status-badge'
image_tag
image_url
,
class:
'js-version-status-badge'
end
end
...
...
app/helpers/visibility_level_helper.rb
View file @
eaada9d7
...
@@ -151,12 +151,12 @@ module VisibilityLevelHelper
...
@@ -151,12 +151,12 @@ module VisibilityLevelHelper
def
restricted_visibility_levels
(
show_all
=
false
)
def
restricted_visibility_levels
(
show_all
=
false
)
return
[]
if
current_user
.
admin?
&&
!
show_all
return
[]
if
current_user
.
admin?
&&
!
show_all
current_application_s
ettings
.
restricted_visibility_levels
||
[]
Gitlab
::
CurrentS
ettings
.
restricted_visibility_levels
||
[]
end
end
delegate
:default_project_visibility
,
delegate
:default_project_visibility
,
:default_group_visibility
,
:default_group_visibility
,
to: :
current_application_settings
to: :
'Gitlab::CurrentSettings.current_application_settings'
def
disallowed_visibility_level?
(
form_model
,
level
)
def
disallowed_visibility_level?
(
form_model
,
level
)
return
false
unless
form_model
.
respond_to?
(
:visibility_level_allowed?
)
return
false
unless
form_model
.
respond_to?
(
:visibility_level_allowed?
)
...
...
app/mailers/abuse_report_mailer.rb
View file @
eaada9d7
class
AbuseReportMailer
<
BaseMailer
class
AbuseReportMailer
<
BaseMailer
include
Gitlab
::
CurrentSettings
def
notify
(
abuse_report_id
)
def
notify
(
abuse_report_id
)
return
unless
deliverable?
return
unless
deliverable?
@abuse_report
=
AbuseReport
.
find
(
abuse_report_id
)
@abuse_report
=
AbuseReport
.
find
(
abuse_report_id
)
mail
(
mail
(
to:
current_application_s
ettings
.
admin_notification_email
,
to:
Gitlab
::
CurrentS
ettings
.
admin_notification_email
,
subject:
"
#{
@abuse_report
.
user
.
name
}
(
#{
@abuse_report
.
user
.
username
}
) was reported for abuse"
subject:
"
#{
@abuse_report
.
user
.
name
}
(
#{
@abuse_report
.
user
.
username
}
) was reported for abuse"
)
)
end
end
...
@@ -15,6 +13,6 @@ class AbuseReportMailer < BaseMailer
...
@@ -15,6 +13,6 @@ class AbuseReportMailer < BaseMailer
private
private
def
deliverable?
def
deliverable?
current_application_s
ettings
.
admin_notification_email
.
present?
Gitlab
::
CurrentS
ettings
.
admin_notification_email
.
present?
end
end
end
end
app/mailers/base_mailer.rb
View file @
eaada9d7
class
BaseMailer
<
ActionMailer
::
Base
class
BaseMailer
<
ActionMailer
::
Base
include
Gitlab
::
CurrentSettings
around_action
:render_with_default_locale
around_action
:render_with_default_locale
helper
ApplicationHelper
helper
ApplicationHelper
helper
MarkupHelper
helper
MarkupHelper
attr_accessor
:current_user
attr_accessor
:current_user
helper_method
:current_user
,
:can?
,
:current_application_settings
helper_method
:current_user
,
:can?
default
from:
proc
{
default_sender_address
.
format
}
default
from:
proc
{
default_sender_address
.
format
}
default
reply_to:
proc
{
default_reply_to_address
.
format
}
default
reply_to:
proc
{
default_reply_to_address
.
format
}
...
...
app/models/clusters/platforms/kubernetes.rb
View file @
eaada9d7
module
Clusters
module
Clusters
module
Platforms
module
Platforms
class
Kubernetes
<
ActiveRecord
::
Base
class
Kubernetes
<
ActiveRecord
::
Base
include
Gitlab
::
CurrentSettings
include
Gitlab
::
Kubernetes
include
Gitlab
::
Kubernetes
include
ReactiveCaching
include
ReactiveCaching
...
@@ -169,7 +168,7 @@ module Clusters
...
@@ -169,7 +168,7 @@ module Clusters
{
{
token:
token
,
token:
token
,
ca_pem:
ca_pem
,
ca_pem:
ca_pem
,
max_session_time:
current_application_s
ettings
.
terminal_max_session_time
max_session_time:
Gitlab
::
CurrentS
ettings
.
terminal_max_session_time
}
}
end
end
...
...
app/models/issue_assignee.rb
View file @
eaada9d7
class
IssueAssignee
<
ActiveRecord
::
Base
class
IssueAssignee
<
ActiveRecord
::
Base
extend
Gitlab
::
CurrentSettings
belongs_to
:issue
belongs_to
:issue
belongs_to
:assignee
,
class_name:
"User"
,
foreign_key: :user_id
belongs_to
:assignee
,
class_name:
"User"
,
foreign_key: :user_id
end
end
app/models/key.rb
View file @
eaada9d7
require
'digest/md5'
require
'digest/md5'
class
Key
<
ActiveRecord
::
Base
class
Key
<
ActiveRecord
::
Base
include
Gitlab
::
CurrentSettings
include
AfterCommitQueue
include
AfterCommitQueue
include
Sortable
include
Sortable
...
@@ -104,7 +103,7 @@ class Key < ActiveRecord::Base
...
@@ -104,7 +103,7 @@ class Key < ActiveRecord::Base
end
end
def
key_meets_restrictions
def
key_meets_restrictions
restriction
=
current_application_s
ettings
.
key_restriction_for
(
public_key
.
type
)
restriction
=
Gitlab
::
CurrentS
ettings
.
key_restriction_for
(
public_key
.
type
)
if
restriction
==
ApplicationSetting
::
FORBIDDEN_KEY_VALUE
if
restriction
==
ApplicationSetting
::
FORBIDDEN_KEY_VALUE
errors
.
add
(
:key
,
forbidden_key_type_message
)
errors
.
add
(
:key
,
forbidden_key_type_message
)
...
@@ -115,7 +114,7 @@ class Key < ActiveRecord::Base
...
@@ -115,7 +114,7 @@ class Key < ActiveRecord::Base
def
forbidden_key_type_message
def
forbidden_key_type_message
allowed_types
=
allowed_types
=
current_application_s
ettings
Gitlab
::
CurrentS
ettings
.
allowed_key_types
.
allowed_key_types
.
map
(
&
:upcase
)
.
map
(
&
:upcase
)
.
to_sentence
(
last_word_connector:
', or '
,
two_words_connector:
' or '
)
.
to_sentence
(
last_word_connector:
', or '
,
two_words_connector:
' or '
)
...
...
app/models/namespace.rb
View file @
eaada9d7
...
@@ -2,7 +2,6 @@ class Namespace < ActiveRecord::Base
...
@@ -2,7 +2,6 @@ class Namespace < ActiveRecord::Base
include
CacheMarkdownField
include
CacheMarkdownField
include
Sortable
include
Sortable
include
Gitlab
::
ShellAdapter
include
Gitlab
::
ShellAdapter
include
Gitlab
::
CurrentSettings
include
Gitlab
::
VisibilityLevel
include
Gitlab
::
VisibilityLevel
include
Routable
include
Routable
include
AfterCommitQueue
include
AfterCommitQueue
...
...
app/models/note.rb
View file @
eaada9d7
...
@@ -3,7 +3,6 @@
...
@@ -3,7 +3,6 @@
# A note of this type is never resolvable.
# A note of this type is never resolvable.
class
Note
<
ActiveRecord
::
Base
class
Note
<
ActiveRecord
::
Base
extend
ActiveModel
::
Naming
extend
ActiveModel
::
Naming
include
Gitlab
::
CurrentSettings
include
Participable
include
Participable
include
Mentionable
include
Mentionable
include
Awardable
include
Awardable
...
@@ -196,7 +195,7 @@ class Note < ActiveRecord::Base
...
@@ -196,7 +195,7 @@ class Note < ActiveRecord::Base
end
end
def
max_attachment_size
def
max_attachment_size
current_application_s
ettings
.
max_attachment_size
.
megabytes
.
to_i
Gitlab
::
CurrentS
ettings
.
max_attachment_size
.
megabytes
.
to_i
end
end
def
hook_attrs
def
hook_attrs
...
...
app/models/project.rb
View file @
eaada9d7
...
@@ -4,7 +4,6 @@ class Project < ActiveRecord::Base
...
@@ -4,7 +4,6 @@ class Project < ActiveRecord::Base
include
Gitlab
::
ConfigHelper
include
Gitlab
::
ConfigHelper
include
Gitlab
::
ShellAdapter
include
Gitlab
::
ShellAdapter
include
Gitlab
::
VisibilityLevel
include
Gitlab
::
VisibilityLevel
include
Gitlab
::
CurrentSettings
include
AccessRequestable
include
AccessRequestable
include
Avatarable
include
Avatarable
include
CacheMarkdownField
include
CacheMarkdownField
...
@@ -23,7 +22,6 @@ class Project < ActiveRecord::Base
...
@@ -23,7 +22,6 @@ class Project < ActiveRecord::Base
include
::
Gitlab
::
Utils
::
StrongMemoize
include
::
Gitlab
::
Utils
::
StrongMemoize
extend
Gitlab
::
ConfigHelper
extend
Gitlab
::
ConfigHelper
extend
Gitlab
::
CurrentSettings
BoardLimitExceeded
=
Class
.
new
(
StandardError
)
BoardLimitExceeded
=
Class
.
new
(
StandardError
)
...
@@ -51,8 +49,8 @@ class Project < ActiveRecord::Base
...
@@ -51,8 +49,8 @@ class Project < ActiveRecord::Base
default_value_for
:visibility_level
,
gitlab_config_features
.
visibility_level
default_value_for
:visibility_level
,
gitlab_config_features
.
visibility_level
default_value_for
:resolve_outdated_diff_discussions
,
false
default_value_for
:resolve_outdated_diff_discussions
,
false
default_value_for
:container_registry_enabled
,
gitlab_config_features
.
container_registry
default_value_for
:container_registry_enabled
,
gitlab_config_features
.
container_registry
default_value_for
(
:repository_storage
)
{
current_application_s
ettings
.
pick_repository_storage
}
default_value_for
(
:repository_storage
)
{
Gitlab
::
CurrentS
ettings
.
pick_repository_storage
}
default_value_for
(
:shared_runners_enabled
)
{
current_application_s
ettings
.
shared_runners_enabled
}
default_value_for
(
:shared_runners_enabled
)
{
Gitlab
::
CurrentS
ettings
.
shared_runners_enabled
}
default_value_for
:issues_enabled
,
gitlab_config_features
.
issues
default_value_for
:issues_enabled
,
gitlab_config_features
.
issues
default_value_for
:merge_requests_enabled
,
gitlab_config_features
.
merge_requests
default_value_for
:merge_requests_enabled
,
gitlab_config_features
.
merge_requests
default_value_for
:builds_enabled
,
gitlab_config_features
.
builds
default_value_for
:builds_enabled
,
gitlab_config_features
.
builds
...
@@ -486,14 +484,14 @@ class Project < ActiveRecord::Base
...
@@ -486,14 +484,14 @@ class Project < ActiveRecord::Base
def
auto_devops_enabled?
def
auto_devops_enabled?
if
auto_devops
&
.
enabled
.
nil?
if
auto_devops
&
.
enabled
.
nil?
current_application_s
ettings
.
auto_devops_enabled?
Gitlab
::
CurrentS
ettings
.
auto_devops_enabled?
else
else
auto_devops
.
enabled?
auto_devops
.
enabled?
end
end
end
end
def
has_auto_devops_implicitly_disabled?
def
has_auto_devops_implicitly_disabled?
auto_devops
&
.
enabled
.
nil?
&&
!
current_application_s
ettings
.
auto_devops_enabled?
auto_devops
&
.
enabled
.
nil?
&&
!
Gitlab
::
CurrentS
ettings
.
auto_devops_enabled?
end
end
def
empty_repo?
def
empty_repo?
...
@@ -1471,14 +1469,14 @@ class Project < ActiveRecord::Base
...
@@ -1471,14 +1469,14 @@ class Project < ActiveRecord::Base
# Ensure HEAD points to the default branch in case it is not master
# Ensure HEAD points to the default branch in case it is not master
change_head
(
default_branch
)
change_head
(
default_branch
)
if
current_application_s
ettings
.
default_branch_protection
!=
Gitlab
::
Access
::
PROTECTION_NONE
&&
!
ProtectedBranch
.
protected?
(
self
,
default_branch
)
if
Gitlab
::
CurrentS
ettings
.
default_branch_protection
!=
Gitlab
::
Access
::
PROTECTION_NONE
&&
!
ProtectedBranch
.
protected?
(
self
,
default_branch
)
params
=
{
params
=
{
name:
default_branch
,
name:
default_branch
,
push_access_levels_attributes:
[{
push_access_levels_attributes:
[{
access_level:
current_application_s
ettings
.
default_branch_protection
==
Gitlab
::
Access
::
PROTECTION_DEV_CAN_PUSH
?
Gitlab
::
Access
::
DEVELOPER
:
Gitlab
::
Access
::
MASTER
access_level:
Gitlab
::
CurrentS
ettings
.
default_branch_protection
==
Gitlab
::
Access
::
PROTECTION_DEV_CAN_PUSH
?
Gitlab
::
Access
::
DEVELOPER
:
Gitlab
::
Access
::
MASTER
}],
}],
merge_access_levels_attributes:
[{
merge_access_levels_attributes:
[{
access_level:
current_application_s
ettings
.
default_branch_protection
==
Gitlab
::
Access
::
PROTECTION_DEV_CAN_MERGE
?
Gitlab
::
Access
::
DEVELOPER
:
Gitlab
::
Access
::
MASTER
access_level:
Gitlab
::
CurrentS
ettings
.
default_branch_protection
==
Gitlab
::
Access
::
PROTECTION_DEV_CAN_MERGE
?
Gitlab
::
Access
::
DEVELOPER
:
Gitlab
::
Access
::
MASTER
}]
}]
}
}
...
@@ -1773,7 +1771,7 @@ class Project < ActiveRecord::Base
...
@@ -1773,7 +1771,7 @@ class Project < ActiveRecord::Base
end
end
def
use_hashed_storage
def
use_hashed_storage
if
self
.
new_record?
&&
current_application_s
ettings
.
hashed_storage_enabled
if
self
.
new_record?
&&
Gitlab
::
CurrentS
ettings
.
hashed_storage_enabled
self
.
storage_version
=
LATEST_STORAGE_VERSION
self
.
storage_version
=
LATEST_STORAGE_VERSION
end
end
end
end
...
...
app/models/project_services/kubernetes_service.rb
View file @
eaada9d7
...
@@ -4,7 +4,6 @@
...
@@ -4,7 +4,6 @@
# After we've migrated data, we'll remove KubernetesService. This would happen in a few months.
# After we've migrated data, we'll remove KubernetesService. This would happen in a few months.
# If you're modyfiyng this class, please note that you should update the same change in Clusters::Platforms::Kubernetes.
# If you're modyfiyng this class, please note that you should update the same change in Clusters::Platforms::Kubernetes.
class
KubernetesService
<
DeploymentService
class
KubernetesService
<
DeploymentService
include
Gitlab
::
CurrentSettings
include
Gitlab
::
Kubernetes
include
Gitlab
::
Kubernetes
include
ReactiveCaching
include
ReactiveCaching
...
@@ -231,7 +230,7 @@ class KubernetesService < DeploymentService
...
@@ -231,7 +230,7 @@ class KubernetesService < DeploymentService
{
{
token:
token
,
token:
token
,
ca_pem:
ca_pem
,
ca_pem:
ca_pem
,
max_session_time:
current_application_s
ettings
.
terminal_max_session_time
max_session_time:
Gitlab
::
CurrentS
ettings
.
terminal_max_session_time
}
}
end
end
...
...
app/models/protected_branch.rb
View file @
eaada9d7
...
@@ -2,8 +2,6 @@ class ProtectedBranch < ActiveRecord::Base
...
@@ -2,8 +2,6 @@ class ProtectedBranch < ActiveRecord::Base
include
Gitlab
::
ShellAdapter
include
Gitlab
::
ShellAdapter
include
ProtectedRef
include
ProtectedRef
extend
Gitlab
::
CurrentSettings
protected_ref_access_levels
:merge
,
:push
protected_ref_access_levels
:merge
,
:push
# Check if branch name is marked as protected in the system
# Check if branch name is marked as protected in the system
...
@@ -16,7 +14,7 @@ class ProtectedBranch < ActiveRecord::Base
...
@@ -16,7 +14,7 @@ class ProtectedBranch < ActiveRecord::Base
end
end
def
self
.
default_branch_protected?
def
self
.
default_branch_protected?
current_application_s
ettings
.
default_branch_protection
==
Gitlab
::
Access
::
PROTECTION_FULL
||
Gitlab
::
CurrentS
ettings
.
default_branch_protection
==
Gitlab
::
Access
::
PROTECTION_FULL
||
current_application_s
ettings
.
default_branch_protection
==
Gitlab
::
Access
::
PROTECTION_DEV_CAN_MERGE
Gitlab
::
CurrentS
ettings
.
default_branch_protection
==
Gitlab
::
Access
::
PROTECTION_DEV_CAN_MERGE
end
end
end
end
app/models/snippet.rb
View file @
eaada9d7
...
@@ -11,8 +11,6 @@ class Snippet < ActiveRecord::Base
...
@@ -11,8 +11,6 @@ class Snippet < ActiveRecord::Base
include
Editable
include
Editable
include
Gitlab
::
SQL
::
Pattern
include
Gitlab
::
SQL
::
Pattern
extend
Gitlab
::
CurrentSettings
cache_markdown_field
:title
,
pipeline: :single_line
cache_markdown_field
:title
,
pipeline: :single_line
cache_markdown_field
:description
cache_markdown_field
:description
cache_markdown_field
:content
cache_markdown_field
:content
...
@@ -28,7 +26,7 @@ class Snippet < ActiveRecord::Base
...
@@ -28,7 +26,7 @@ class Snippet < ActiveRecord::Base
default_content_html_invalidator
||
file_name_changed?
default_content_html_invalidator
||
file_name_changed?
end
end
default_value_for
(
:visibility_level
)
{
current_application_s
ettings
.
default_snippet_visibility
}
default_value_for
(
:visibility_level
)
{
Gitlab
::
CurrentS
ettings
.
default_snippet_visibility
}
belongs_to
:author
,
class_name:
'User'
belongs_to
:author
,
class_name:
'User'
belongs_to
:project
belongs_to
:project
...
...
app/models/user.rb
View file @
eaada9d7
...
@@ -2,10 +2,8 @@ require 'carrierwave/orm/activerecord'
...
@@ -2,10 +2,8 @@ require 'carrierwave/orm/activerecord'
class
User
<
ActiveRecord
::
Base
class
User
<
ActiveRecord
::
Base
extend
Gitlab
::
ConfigHelper
extend
Gitlab
::
ConfigHelper
extend
Gitlab
::
CurrentSettings
include
Gitlab
::
ConfigHelper
include
Gitlab
::
ConfigHelper
include
Gitlab
::
CurrentSettings
include
Gitlab
::
SQL
::
Pattern
include
Gitlab
::
SQL
::
Pattern
include
AfterCommitQueue
include
AfterCommitQueue
include
Avatarable
include
Avatarable
...
@@ -30,7 +28,7 @@ class User < ActiveRecord::Base
...
@@ -30,7 +28,7 @@ class User < ActiveRecord::Base
add_authentication_token_field
:rss_token
add_authentication_token_field
:rss_token
default_value_for
:admin
,
false
default_value_for
:admin
,
false
default_value_for
(
:external
)
{
current_application_s
ettings
.
user_default_external
}
default_value_for
(
:external
)
{
Gitlab
::
CurrentS
ettings
.
user_default_external
}
default_value_for
:can_create_group
,
gitlab_config
.
default_can_create_group
default_value_for
:can_create_group
,
gitlab_config
.
default_can_create_group
default_value_for
:can_create_team
,
false
default_value_for
:can_create_team
,
false
default_value_for
:hide_no_ssh_key
,
false
default_value_for
:hide_no_ssh_key
,
false
...
@@ -660,11 +658,11 @@ class User < ActiveRecord::Base
...
@@ -660,11 +658,11 @@ class User < ActiveRecord::Base
end
end
def
allow_password_authentication_for_web?
def
allow_password_authentication_for_web?
current_application_s
ettings
.
password_authentication_enabled_for_web?
&&
!
ldap_user?
Gitlab
::
CurrentS
ettings
.
password_authentication_enabled_for_web?
&&
!
ldap_user?
end
end
def
allow_password_authentication_for_git?
def
allow_password_authentication_for_git?
current_application_s
ettings
.
password_authentication_enabled_for_git?
&&
!
ldap_user?
Gitlab
::
CurrentS
ettings
.
password_authentication_enabled_for_git?
&&
!
ldap_user?
end
end
def
can_change_username?
def
can_change_username?
...
@@ -792,7 +790,7 @@ class User < ActiveRecord::Base
...
@@ -792,7 +790,7 @@ class User < ActiveRecord::Base
# without this safeguard!
# without this safeguard!
return
unless
has_attribute?
(
:projects_limit
)
&&
projects_limit
.
nil?
return
unless
has_attribute?
(
:projects_limit
)
&&
projects_limit
.
nil?
self
.
projects_limit
=
current_application_s
ettings
.
default_projects_limit
self
.
projects_limit
=
Gitlab
::
CurrentS
ettings
.
default_projects_limit
end
end
def
requires_ldap_check?
def
requires_ldap_check?
...
@@ -1215,7 +1213,7 @@ class User < ActiveRecord::Base
...
@@ -1215,7 +1213,7 @@ class User < ActiveRecord::Base
else
else
# Only revert these back to the default if they weren't specifically changed in this update.
# Only revert these back to the default if they weren't specifically changed in this update.
self
.
can_create_group
=
gitlab_config
.
default_can_create_group
unless
can_create_group_changed?
self
.
can_create_group
=
gitlab_config
.
default_can_create_group
unless
can_create_group_changed?
self
.
projects_limit
=
current_application_s
ettings
.
default_projects_limit
unless
projects_limit_changed?
self
.
projects_limit
=
Gitlab
::
CurrentS
ettings
.
default_projects_limit
unless
projects_limit_changed?
end
end
end
end
...
@@ -1223,15 +1221,15 @@ class User < ActiveRecord::Base
...
@@ -1223,15 +1221,15 @@ class User < ActiveRecord::Base
valid
=
true
valid
=
true
error
=
nil
error
=
nil
if
current_application_s
ettings
.
domain_blacklist_enabled?
if
Gitlab
::
CurrentS
ettings
.
domain_blacklist_enabled?
blocked_domains
=
current_application_s
ettings
.
domain_blacklist
blocked_domains
=
Gitlab
::
CurrentS
ettings
.
domain_blacklist
if
domain_matches?
(
blocked_domains
,
email
)
if
domain_matches?
(
blocked_domains
,
email
)
error
=
'is not from an allowed domain.'
error
=
'is not from an allowed domain.'
valid
=
false
valid
=
false
end
end
end
end
allowed_domains
=
current_application_s
ettings
.
domain_whitelist
allowed_domains
=
Gitlab
::
CurrentS
ettings
.
domain_whitelist
unless
allowed_domains
.
blank?
unless
allowed_domains
.
blank?
if
domain_matches?
(
allowed_domains
,
email
)
if
domain_matches?
(
allowed_domains
,
email
)
valid
=
true
valid
=
true
...
...
app/services/akismet_service.rb
View file @
eaada9d7
class
AkismetService
class
AkismetService
include
Gitlab
::
CurrentSettings
attr_accessor
:owner
,
:text
,
:options
attr_accessor
:owner
,
:text
,
:options
def
initialize
(
owner
,
text
,
options
=
{})
def
initialize
(
owner
,
text
,
options
=
{})
...
@@ -41,12 +39,12 @@ class AkismetService
...
@@ -41,12 +39,12 @@ class AkismetService
private
private
def
akismet_client
def
akismet_client
@akismet_client
||=
::
Akismet
::
Client
.
new
(
current_application_s
ettings
.
akismet_api_key
,
@akismet_client
||=
::
Akismet
::
Client
.
new
(
Gitlab
::
CurrentS
ettings
.
akismet_api_key
,
Gitlab
.
config
.
gitlab
.
url
)
Gitlab
.
config
.
gitlab
.
url
)
end
end
def
akismet_enabled?
def
akismet_enabled?
current_application_s
ettings
.
akismet_enabled
Gitlab
::
CurrentS
ettings
.
akismet_enabled
end
end
def
submit
(
type
)
def
submit
(
type
)
...
...
app/services/auth/container_registry_authentication_service.rb
View file @
eaada9d7
module
Auth
module
Auth
class
ContainerRegistryAuthenticationService
<
BaseService
class
ContainerRegistryAuthenticationService
<
BaseService
extend
Gitlab
::
CurrentSettings
AUDIENCE
=
'container_registry'
.
freeze
AUDIENCE
=
'container_registry'
.
freeze
def
execute
(
authentication_abilities
:)
def
execute
(
authentication_abilities
:)
...
@@ -32,7 +30,7 @@ module Auth
...
@@ -32,7 +30,7 @@ module Auth
end
end
def
self
.
token_expire_at
def
self
.
token_expire_at
Time
.
now
+
current_application_s
ettings
.
container_registry_token_expire_delay
.
minutes
Time
.
now
+
Gitlab
::
CurrentS
ettings
.
container_registry_token_expire_delay
.
minutes
end
end
private
private
...
...
app/services/base_service.rb
View file @
eaada9d7
class
BaseService
class
BaseService
include
Gitlab
::
Allowable
include
Gitlab
::
Allowable
include
Gitlab
::
CurrentSettings
attr_accessor
:project
,
:current_user
,
:params
attr_accessor
:project
,
:current_user
,
:params
...
...
app/services/ci/register_job_service.rb
View file @
eaada9d7
...
@@ -2,8 +2,6 @@ module Ci
...
@@ -2,8 +2,6 @@ module Ci
# This class responsible for assigning
# This class responsible for assigning
# proper pending build to runner on runner API request
# proper pending build to runner on runner API request
class
RegisterJobService
class
RegisterJobService
include
Gitlab
::
CurrentSettings
attr_reader
:runner
attr_reader
:runner
Result
=
Struct
.
new
(
:build
,
:valid?
)
Result
=
Struct
.
new
(
:build
,
:valid?
)
...
...
app/services/git_push_service.rb
View file @
eaada9d7
class
GitPushService
<
BaseService
class
GitPushService
<
BaseService
attr_accessor
:push_data
,
:push_commits
attr_accessor
:push_data
,
:push_commits
include
Gitlab
::
CurrentSettings
include
Gitlab
::
Access
include
Gitlab
::
Access
# The N most recent commits to process in a single push payload.
# The N most recent commits to process in a single push payload.
...
...
app/services/gravatar_service.rb
View file @
eaada9d7
class
GravatarService
class
GravatarService
include
Gitlab
::
CurrentSettings
def
execute
(
email
,
size
=
nil
,
scale
=
2
,
username:
nil
)
def
execute
(
email
,
size
=
nil
,
scale
=
2
,
username:
nil
)
return
unless
current_application_s
ettings
.
gravatar_enabled?
return
unless
Gitlab
::
CurrentS
ettings
.
gravatar_enabled?
identifier
=
email
.
presence
||
username
.
presence
identifier
=
email
.
presence
||
username
.
presence
return
unless
identifier
return
unless
identifier
...
...
app/services/projects/housekeeping_service.rb
View file @
eaada9d7
...
@@ -7,8 +7,6 @@
...
@@ -7,8 +7,6 @@
#
#
module
Projects
module
Projects
class
HousekeepingService
<
BaseService
class
HousekeepingService
<
BaseService
include
Gitlab
::
CurrentSettings
# Timeout set to 24h
# Timeout set to 24h
LEASE_TIMEOUT
=
86400
LEASE_TIMEOUT
=
86400
...
@@ -83,19 +81,19 @@ module Projects
...
@@ -83,19 +81,19 @@ module Projects
end
end
def
housekeeping_enabled?
def
housekeeping_enabled?
current_application_s
ettings
.
housekeeping_enabled
Gitlab
::
CurrentS
ettings
.
housekeeping_enabled
end
end
def
gc_period
def
gc_period
current_application_s
ettings
.
housekeeping_gc_period
Gitlab
::
CurrentS
ettings
.
housekeeping_gc_period
end
end
def
full_repack_period
def
full_repack_period
current_application_s
ettings
.
housekeeping_full_repack_period
Gitlab
::
CurrentS
ettings
.
housekeeping_full_repack_period
end
end
def
repack_period
def
repack_period
current_application_s
ettings
.
housekeeping_incremental_repack_period
Gitlab
::
CurrentS
ettings
.
housekeeping_incremental_repack_period
end
end
end
end
end
end
app/services/projects/update_pages_service.rb
View file @
eaada9d7
module
Projects
module
Projects
class
UpdatePagesService
<
BaseService
class
UpdatePagesService
<
BaseService
include
Gitlab
::
CurrentSettings
BLOCK_SIZE
=
32
.
kilobytes
BLOCK_SIZE
=
32
.
kilobytes
MAX_SIZE
=
1
.
terabyte
MAX_SIZE
=
1
.
terabyte
SITE_PATH
=
'public/'
.
freeze
SITE_PATH
=
'public/'
.
freeze
...
@@ -134,7 +132,7 @@ module Projects
...
@@ -134,7 +132,7 @@ module Projects
end
end
def
max_size
def
max_size
max_pages_size
=
current_application_s
ettings
.
max_pages_size
.
megabytes
max_pages_size
=
Gitlab
::
CurrentS
ettings
.
max_pages_size
.
megabytes
return
MAX_SIZE
if
max_pages_size
.
zero?
return
MAX_SIZE
if
max_pages_size
.
zero?
...
...
app/services/projects/update_service.rb
View file @
eaada9d7
...
@@ -34,7 +34,7 @@ module Projects
...
@@ -34,7 +34,7 @@ module Projects
def
run_auto_devops_pipeline?
def
run_auto_devops_pipeline?
return
false
if
project
.
repository
.
gitlab_ci_yml
||
!
project
.
auto_devops
.
previous_changes
.
include?
(
'enabled'
)
return
false
if
project
.
repository
.
gitlab_ci_yml
||
!
project
.
auto_devops
.
previous_changes
.
include?
(
'enabled'
)
project
.
auto_devops
.
enabled?
||
(
project
.
auto_devops
.
enabled
.
nil?
&&
current_application_s
ettings
.
auto_devops_enabled?
)
project
.
auto_devops
.
enabled?
||
(
project
.
auto_devops
.
enabled
.
nil?
&&
Gitlab
::
CurrentS
ettings
.
auto_devops_enabled?
)
end
end
private
private
...
...
app/services/submit_usage_ping_service.rb
View file @
eaada9d7
...
@@ -11,10 +11,8 @@ class SubmitUsagePingService
...
@@ -11,10 +11,8 @@ class SubmitUsagePingService
percentage_projects_prometheus_active leader_service_desk_issues instance_service_desk_issues
percentage_projects_prometheus_active leader_service_desk_issues instance_service_desk_issues
percentage_service_desk_issues]
.
freeze
percentage_service_desk_issues]
.
freeze
include
Gitlab
::
CurrentSettings
def
execute
def
execute
return
false
unless
current_application_s
ettings
.
usage_ping_enabled?
return
false
unless
Gitlab
::
CurrentS
ettings
.
usage_ping_enabled?
response
=
HTTParty
.
post
(
response
=
HTTParty
.
post
(
URL
,
URL
,
...
...
app/services/upload_service.rb
View file @
eaada9d7
class
UploadService
class
UploadService
include
Gitlab
::
CurrentSettings
def
initialize
(
model
,
file
,
uploader_class
=
FileUploader
)
def
initialize
(
model
,
file
,
uploader_class
=
FileUploader
)
@model
,
@file
,
@uploader_class
=
model
,
file
,
uploader_class
@model
,
@file
,
@uploader_class
=
model
,
file
,
uploader_class
end
end
...
@@ -17,6 +15,6 @@ class UploadService
...
@@ -17,6 +15,6 @@ class UploadService
private
private
def
max_attachment_size
def
max_attachment_size
current_application_s
ettings
.
max_attachment_size
.
megabytes
.
to_i
Gitlab
::
CurrentS
ettings
.
max_attachment_size
.
megabytes
.
to_i
end
end
end
end
app/services/users/build_service.rb
View file @
eaada9d7
module
Users
module
Users
class
BuildService
<
BaseService
class
BuildService
<
BaseService
include
Gitlab
::
CurrentSettings
def
initialize
(
current_user
,
params
=
{})
def
initialize
(
current_user
,
params
=
{})
@current_user
=
current_user
@current_user
=
current_user
@params
=
params
.
dup
@params
=
params
.
dup
...
@@ -34,7 +32,7 @@ module Users
...
@@ -34,7 +32,7 @@ module Users
private
private
def
can_create_user?
def
can_create_user?
(
current_user
.
nil?
&&
current_application_s
ettings
.
allow_signup?
)
||
current_user
&
.
admin?
(
current_user
.
nil?
&&
Gitlab
::
CurrentS
ettings
.
allow_signup?
)
||
current_user
&
.
admin?
end
end
# Allowed params for creating a user (admins only)
# Allowed params for creating a user (admins only)
...
@@ -102,7 +100,7 @@ module Users
...
@@ -102,7 +100,7 @@ module Users
end
end
def
skip_user_confirmation_email_from_setting
def
skip_user_confirmation_email_from_setting
!
current_application_s
ettings
.
send_user_confirmation_email
!
Gitlab
::
CurrentS
ettings
.
send_user_confirmation_email
end
end
end
end
end
end
app/views/admin/conversational_development_index/show.html.haml
View file @
eaada9d7
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
=
render
'callout'
=
render
'callout'
.prepend-top-default
.prepend-top-default
-
if
!
current_application_s
ettings
.
usage_ping_enabled
-
if
!
Gitlab
::
CurrentS
ettings
.
usage_ping_enabled
=
render
'disabled'
=
render
'disabled'
-
elsif
@metric
.
blank?
-
elsif
@metric
.
blank?
=
render
'no_data'
=
render
'no_data'
...
...
app/views/admin/dashboard/index.html.haml
View file @
eaada9d7
...
@@ -119,7 +119,7 @@
...
@@ -119,7 +119,7 @@
.well-segment.admin-well
.well-segment.admin-well
%h4
%h4
Components
Components
-
if
current_application_s
ettings
.
version_check_enabled
-
if
Gitlab
::
CurrentS
ettings
.
version_check_enabled
.pull-right
.pull-right
=
version_status_badge
=
version_status_badge
%p
%p
...
...
app/views/admin/health_check/show.html.haml
View file @
eaada9d7
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
.pull-left
.pull-left
%p
%p
#{
s_
(
'HealthCheck|Access token is'
)
}
#{
s_
(
'HealthCheck|Access token is'
)
}
%code
#health-check-token
=
current_application_s
ettings
.
health_check_access_token
%code
#health-check-token
=
Gitlab
::
CurrentS
ettings
.
health_check_access_token
.prepend-top-10
.prepend-top-10
=
button_to
_
(
"Reset health check access token"
),
reset_health_check_token_admin_application_settings_path
,
=
button_to
_
(
"Reset health check access token"
),
reset_health_check_token_admin_application_settings_path
,
method: :put
,
class:
'btn btn-default'
,
method: :put
,
class:
'btn btn-default'
,
...
@@ -18,11 +18,11 @@
...
@@ -18,11 +18,11 @@
=
link_to
s_
(
'More information is available|here'
),
help_page_path
(
'user/admin_area/monitoring/health_check'
)
=
link_to
s_
(
'More information is available|here'
),
help_page_path
(
'user/admin_area/monitoring/health_check'
)
%ul
%ul
%li
%li
%code
=
readiness_url
(
token:
current_application_s
ettings
.
health_check_access_token
)
%code
=
readiness_url
(
token:
Gitlab
::
CurrentS
ettings
.
health_check_access_token
)
%li
%li
%code
=
liveness_url
(
token:
current_application_s
ettings
.
health_check_access_token
)
%code
=
liveness_url
(
token:
Gitlab
::
CurrentS
ettings
.
health_check_access_token
)
%li
%li
%code
=
metrics_url
(
token:
current_application_s
ettings
.
health_check_access_token
)
%code
=
metrics_url
(
token:
Gitlab
::
CurrentS
ettings
.
health_check_access_token
)
%hr
%hr
.panel.panel-default
.panel.panel-default
...
...
app/views/admin/runners/index.html.haml
View file @
eaada9d7
...
@@ -36,7 +36,7 @@
...
@@ -36,7 +36,7 @@
data:
{
confirm:
_
(
"Are you sure you want to reset registration token?"
)
}
data:
{
confirm:
_
(
"Are you sure you want to reset registration token?"
)
}
=
render
partial:
'ci/runner/how_to_setup_runner'
,
=
render
partial:
'ci/runner/how_to_setup_runner'
,
locals:
{
registration_token:
current_application_s
ettings
.
runners_registration_token
,
locals:
{
registration_token:
Gitlab
::
CurrentS
ettings
.
runners_registration_token
,
type:
'shared'
}
type:
'shared'
}
.append-bottom-20.clearfix
.append-bottom-20.clearfix
...
...
app/views/devise/confirmations/almost_there.haml
View file @
eaada9d7
...
@@ -4,9 +4,9 @@
...
@@ -4,9 +4,9 @@
%p
.lead.append-bottom-20
%p
.lead.append-bottom-20
Please check your email to confirm your account
Please check your email to confirm your account
%hr
%hr
-
if
current_application_s
ettings
.
after_sign_up_text
.
present?
-
if
Gitlab
::
CurrentS
ettings
.
after_sign_up_text
.
present?
.well-confirmation.text-center
.well-confirmation.text-center
=
markdown_field
(
current_application_s
ettings
,
:after_sign_up_text
)
=
markdown_field
(
Gitlab
::
CurrentS
ettings
,
:after_sign_up_text
)
%p
.text-center
%p
.text-center
No confirmation email received? Please check your spam folder or
No confirmation email received? Please check your spam folder or
.append-bottom-20.prepend-top-20.text-center
.append-bottom-20.prepend-top-20.text-center
...
...
app/views/help/index.html.haml
View file @
eaada9d7
=
webpack_bundle_tag
'docs'
=
webpack_bundle_tag
'docs'
%div
%div
-
if
current_application_s
ettings
.
help_page_text
.
present?
-
if
Gitlab
::
CurrentS
ettings
.
help_page_text
.
present?
=
markdown_field
(
current_application_settings
,
:help_page_text
)
=
markdown_field
(
Gitlab
::
CurrentSettings
.
current_application_settings
,
:help_page_text
)
%hr
%hr
%h1
%h1
...
@@ -14,7 +14,7 @@
...
@@ -14,7 +14,7 @@
=
version_status_badge
=
version_status_badge
%hr
%hr
-
unless
current_application_s
ettings
.
help_page_hide_commercial_content?
-
unless
Gitlab
::
CurrentS
ettings
.
help_page_hide_commercial_content?
%p
.slead
%p
.slead
GitLab is open source software to collaborate on code.
GitLab is open source software to collaborate on code.
%br
%br
...
@@ -46,6 +46,6 @@
...
@@ -46,6 +46,6 @@
%li
%li
%button
.btn-blank.btn-link.js-trigger-shortcut
{
type:
'button'
}
%button
.btn-blank.btn-link.js-trigger-shortcut
{
type:
'button'
}
Use shortcuts
Use shortcuts
-
unless
current_application_s
ettings
.
help_page_hide_commercial_content?
-
unless
Gitlab
::
CurrentS
ettings
.
help_page_hide_commercial_content?
%li
=
link_to
'Get a support subscription'
,
'https://about.gitlab.com/pricing/'
%li
=
link_to
'Get a support subscription'
,
'https://about.gitlab.com/pricing/'
%li
=
link_to
'Compare GitLab editions'
,
'https://about.gitlab.com/features/#compare'
%li
=
link_to
'Compare GitLab editions'
,
'https://about.gitlab.com/features/#compare'
app/views/koding/index.html.haml
View file @
eaada9d7
...
@@ -3,4 +3,4 @@
...
@@ -3,4 +3,4 @@
=
icon
(
'circle'
,
class:
'cgreen'
)
=
icon
(
'circle'
,
class:
'cgreen'
)
Integration is active for
Integration is active for
=
link_to
koding_project_url
,
target:
'_blank'
,
rel:
'noopener noreferrer'
do
=
link_to
koding_project_url
,
target:
'_blank'
,
rel:
'noopener noreferrer'
do
#{
current_application_s
ettings
.
koding_url
}
#{
Gitlab
::
CurrentS
ettings
.
koding_url
}
app/views/layouts/_head.html.haml
View file @
eaada9d7
...
@@ -41,7 +41,7 @@
...
@@ -41,7 +41,7 @@
=
webpack_bundle_tag
"webpack_runtime"
=
webpack_bundle_tag
"webpack_runtime"
=
webpack_bundle_tag
"common"
=
webpack_bundle_tag
"common"
=
webpack_bundle_tag
"main"
=
webpack_bundle_tag
"main"
=
webpack_bundle_tag
"raven"
if
current_application_s
ettings
.
clientside_sentry_enabled
=
webpack_bundle_tag
"raven"
if
Gitlab
::
CurrentS
ettings
.
clientside_sentry_enabled
=
webpack_bundle_tag
"test"
if
Rails
.
env
.
test?
=
webpack_bundle_tag
"test"
if
Rails
.
env
.
test?
-
if
content_for?
(
:page_specific_javascripts
)
-
if
content_for?
(
:page_specific_javascripts
)
...
...
app/views/layouts/devise.html.haml
View file @
eaada9d7
...
@@ -26,8 +26,8 @@
...
@@ -26,8 +26,8 @@
Perform code reviews and enhance collaboration with merge requests.
Perform code reviews and enhance collaboration with merge requests.
Each project can also have an issue tracker and a wiki.
Each project can also have an issue tracker and a wiki.
-
if
current_application_s
ettings
.
sign_in_text
.
present?
-
if
Gitlab
::
CurrentS
ettings
.
sign_in_text
.
present?
=
markdown_field
(
current_application_settings
,
:sign_in_text
)
=
markdown_field
(
Gitlab
::
CurrentSettings
.
current_application_settings
,
:sign_in_text
)
%hr
.footer-fixed
%hr
.footer-fixed
.container.footer-container
.container.footer-container
...
...
app/views/layouts/nav/sidebar/_profile.html.haml
View file @
eaada9d7
...
@@ -28,7 +28,7 @@
...
@@ -28,7 +28,7 @@
=
link_to
profile_account_path
do
=
link_to
profile_account_path
do
%strong
.fly-out-top-item-name
%strong
.fly-out-top-item-name
#{
_
(
'Account'
)
}
#{
_
(
'Account'
)
}
-
if
current_application_s
ettings
.
user_oauth_applications?
-
if
Gitlab
::
CurrentS
ettings
.
user_oauth_applications?
=
nav_link
(
controller:
'oauth/applications'
)
do
=
nav_link
(
controller:
'oauth/applications'
)
do
=
link_to
applications_profile_path
do
=
link_to
applications_profile_path
do
.nav-icon-container
.nav-icon-container
...
...
app/views/notify/_note_email.html.haml
View file @
eaada9d7
...
@@ -22,7 +22,7 @@
...
@@ -22,7 +22,7 @@
-
else
-
else
commented on a
#{
link_to
'discussion'
,
@target_url
}
commented on a
#{
link_to
'discussion'
,
@target_url
}
-
elsif
current_application_s
ettings
.
email_author_in_body
-
elsif
Gitlab
::
CurrentS
ettings
.
email_author_in_body
%p
.details
%p
.details
#{
link_to
@note
.
author_name
,
user_url
(
@note
.
author
)
}
commented:
#{
link_to
@note
.
author_name
,
user_url
(
@note
.
author
)
}
commented:
...
...
app/views/notify/_note_email.text.erb
View file @
eaada9d7
...
@@ -12,7 +12,7 @@
...
@@ -12,7 +12,7 @@
<%=
":"
-%>
<%=
":"
-%>
<%
elsif
current_application_s
ettings
.
email_author_in_body
-%>
<%
elsif
Gitlab
::
CurrentS
ettings
.
email_author_in_body
-%>
<%=
"
#{
@note
.
author_name
}
commented:"
-%>
<%=
"
#{
@note
.
author_name
}
commented:"
-%>
...
...
app/views/notify/new_issue_email.html.haml
View file @
eaada9d7
-
if
current_application_s
ettings
.
email_author_in_body
-
if
Gitlab
::
CurrentS
ettings
.
email_author_in_body
%p
.details
%p
.details
#{
link_to
@issue
.
author_name
,
user_url
(
@issue
.
author
)
}
created an issue:
#{
link_to
@issue
.
author_name
,
user_url
(
@issue
.
author
)
}
created an issue:
...
...
app/views/notify/new_merge_request_email.html.haml
View file @
eaada9d7
-
if
current_application_s
ettings
.
email_author_in_body
-
if
Gitlab
::
CurrentS
ettings
.
email_author_in_body
%p
.details
%p
.details
#{
link_to
@merge_request
.
author_name
,
user_url
(
@merge_request
.
author
)
}
created a merge request:
#{
link_to
@merge_request
.
author_name
,
user_url
(
@merge_request
.
author
)
}
created a merge request:
...
...
app/views/notify/new_user_email.html.haml
View file @
eaada9d7
%p
%p
Hi
#{
@user
[
'name'
]
}
!
Hi
#{
@user
[
'name'
]
}
!
%p
%p
-
if
current_application_s
ettings
.
allow_signup?
-
if
Gitlab
::
CurrentS
ettings
.
allow_signup?
Your account has been created successfully.
Your account has been created successfully.
-
else
-
else
The Administrator created an account for you. Now you are a member of the company GitLab application.
The Administrator created an account for you. Now you are a member of the company GitLab application.
...
...
app/views/projects/_export.html.haml
View file @
eaada9d7
-
return
unless
current_application_s
ettings
.
project_export_enabled?
-
return
unless
Gitlab
::
CurrentS
ettings
.
project_export_enabled?
-
project
=
local_assigns
.
fetch
(
:project
)
-
project
=
local_assigns
.
fetch
(
:project
)
-
expanded
=
Rails
.
env
.
test?
-
expanded
=
Rails
.
env
.
test?
...
...
app/views/projects/commits/_commit.html.haml
View file @
eaada9d7
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
-
link
=
commit_path
(
project
,
commit
,
merge_request:
merge_request
)
-
link
=
commit_path
(
project
,
commit
,
merge_request:
merge_request
)
-
cache_key
=
[
project
.
full_path
,
-
cache_key
=
[
project
.
full_path
,
commit
.
id
,
commit
.
id
,
current_application_settings
,
Gitlab
::
CurrentSettings
.
current_application_settings
,
@path
.
presence
,
@path
.
presence
,
current_controller?
(
:commits
),
current_controller?
(
:commits
),
merge_request
&
.
iid
,
merge_request
&
.
iid
,
...
...
app/views/projects/pipelines_settings/_show.html.haml
View file @
eaada9d7
...
@@ -31,7 +31,7 @@
...
@@ -31,7 +31,7 @@
.radio
.radio
=
form
.
label
:enabled_
do
=
form
.
label
:enabled_
do
=
form
.
radio_button
:enabled
,
''
=
form
.
radio_button
:enabled
,
''
%strong
Instance default (
#{
current_application_s
ettings
.
auto_devops_enabled?
?
'enabled'
:
'disabled'
}
)
%strong
Instance default (
#{
Gitlab
::
CurrentS
ettings
.
auto_devops_enabled?
?
'enabled'
:
'disabled'
}
)
%br
%br
%span
.descr
%span
.descr
Follow the instance default to either have Auto DevOps enabled or disabled when there is no project specific
<code>
.gitlab-ci.yml
</code>
.
Follow the instance default to either have Auto DevOps enabled or disabled when there is no project specific
<code>
.gitlab-ci.yml
</code>
.
...
...
app/views/projects/runners/_shared_runners.html.haml
View file @
eaada9d7
%h3
Shared Runners
%h3
Shared Runners
.bs-callout.bs-callout-warning.shared-runners-description
.bs-callout.bs-callout-warning.shared-runners-description
-
if
current_application_s
ettings
.
shared_runners_text
.
present?
-
if
Gitlab
::
CurrentS
ettings
.
shared_runners_text
.
present?
=
markdown_field
(
current_application_settings
,
:shared_runners_text
)
=
markdown_field
(
Gitlab
::
CurrentSettings
.
current_application_settings
,
:shared_runners_text
)
-
else
-
else
GitLab Shared Runners execute code of different projects on the same Runner
GitLab Shared Runners execute code of different projects on the same Runner
unless you configure GitLab Runner Autoscale with MaxBuilds 1 (which it is
unless you configure GitLab Runner Autoscale with MaxBuilds 1 (which it is
...
...
app/workers/git_garbage_collect_worker.rb
View file @
eaada9d7
class
GitGarbageCollectWorker
class
GitGarbageCollectWorker
include
ApplicationWorker
include
ApplicationWorker
include
Gitlab
::
CurrentSettings
sidekiq_options
retry:
false
sidekiq_options
retry:
false
...
@@ -102,7 +101,7 @@ class GitGarbageCollectWorker
...
@@ -102,7 +101,7 @@ class GitGarbageCollectWorker
end
end
def
bitmaps_enabled?
def
bitmaps_enabled?
current_application_s
ettings
.
housekeeping_bitmaps_enabled
Gitlab
::
CurrentS
ettings
.
housekeeping_bitmaps_enabled
end
end
def
git
(
write_bitmaps
:)
def
git
(
write_bitmaps
:)
...
...
lib/api/helpers/runner.rb
View file @
eaada9d7
module
API
module
API
module
Helpers
module
Helpers
module
Runner
module
Runner
include
Gitlab
::
CurrentSettings
JOB_TOKEN_HEADER
=
'HTTP_JOB_TOKEN'
.
freeze
JOB_TOKEN_HEADER
=
'HTTP_JOB_TOKEN'
.
freeze
JOB_TOKEN_PARAM
=
:token
JOB_TOKEN_PARAM
=
:token
UPDATE_RUNNER_EVERY
=
10
*
60
UPDATE_RUNNER_EVERY
=
10
*
60
def
runner_registration_token_valid?
def
runner_registration_token_valid?
ActiveSupport
::
SecurityUtils
.
variable_size_secure_compare
(
params
[
:token
],
ActiveSupport
::
SecurityUtils
.
variable_size_secure_compare
(
params
[
:token
],
current_application_s
ettings
.
runners_registration_token
)
Gitlab
::
CurrentS
ettings
.
runners_registration_token
)
end
end
def
get_runner_version_from_params
def
get_runner_version_from_params
...
@@ -70,7 +68,7 @@ module API
...
@@ -70,7 +68,7 @@ module API
end
end
def
max_artifacts_size
def
max_artifacts_size
current_application_s
ettings
.
max_artifacts_size
.
megabytes
.
to_i
Gitlab
::
CurrentS
ettings
.
max_artifacts_size
.
megabytes
.
to_i
end
end
end
end
end
end
...
...
lib/email_template_interceptor.rb
View file @
eaada9d7
# Read about interceptors in http://guides.rubyonrails.org/action_mailer_basics.html#intercepting-emails
# Read about interceptors in http://guides.rubyonrails.org/action_mailer_basics.html#intercepting-emails
class
EmailTemplateInterceptor
class
EmailTemplateInterceptor
extend
Gitlab
::
CurrentSettings
def
self
.
delivering_email
(
message
)
def
self
.
delivering_email
(
message
)
# Remove HTML part if HTML emails are disabled.
# Remove HTML part if HTML emails are disabled.
unless
current_application_s
ettings
.
html_emails_enabled
unless
Gitlab
::
CurrentS
ettings
.
html_emails_enabled
message
.
parts
.
delete_if
do
|
part
|
message
.
parts
.
delete_if
do
|
part
|
part
.
content_type
.
start_with?
(
'text/html'
)
part
.
content_type
.
start_with?
(
'text/html'
)
end
end
...
...
lib/gitlab/asciidoc.rb
View file @
eaada9d7
...
@@ -6,8 +6,6 @@ module Gitlab
...
@@ -6,8 +6,6 @@ module Gitlab
# Parser/renderer for the AsciiDoc format that uses Asciidoctor and filters
# Parser/renderer for the AsciiDoc format that uses Asciidoctor and filters
# the resulting HTML through HTML pipeline filters.
# the resulting HTML through HTML pipeline filters.
module
Asciidoc
module
Asciidoc
extend
Gitlab
::
CurrentSettings
DEFAULT_ADOC_ATTRS
=
[
DEFAULT_ADOC_ATTRS
=
[
'showtitle'
,
'idprefix=user-content-'
,
'idseparator=-'
,
'env=gitlab'
,
'showtitle'
,
'idprefix=user-content-'
,
'idseparator=-'
,
'env=gitlab'
,
'env-gitlab'
,
'source-highlighter=html-pipeline'
,
'icons=font'
'env-gitlab'
,
'source-highlighter=html-pipeline'
,
'icons=font'
...
@@ -33,9 +31,9 @@ module Gitlab
...
@@ -33,9 +31,9 @@ module Gitlab
def
self
.
plantuml_setup
def
self
.
plantuml_setup
Asciidoctor
::
PlantUml
.
configure
do
|
conf
|
Asciidoctor
::
PlantUml
.
configure
do
|
conf
|
conf
.
url
=
current_application_s
ettings
.
plantuml_url
conf
.
url
=
Gitlab
::
CurrentS
ettings
.
plantuml_url
conf
.
svg_enable
=
current_application_s
ettings
.
plantuml_enabled
conf
.
svg_enable
=
Gitlab
::
CurrentS
ettings
.
plantuml_enabled
conf
.
png_enable
=
current_application_s
ettings
.
plantuml_enabled
conf
.
png_enable
=
Gitlab
::
CurrentS
ettings
.
plantuml_enabled
conf
.
txt_enable
=
false
conf
.
txt_enable
=
false
end
end
end
end
...
...
lib/gitlab/auth.rb
View file @
eaada9d7
...
@@ -14,8 +14,6 @@ module Gitlab
...
@@ -14,8 +14,6 @@ module Gitlab
DEFAULT_SCOPES
=
[
:api
].
freeze
DEFAULT_SCOPES
=
[
:api
].
freeze
class
<<
self
class
<<
self
include
Gitlab
::
CurrentSettings
def
find_for_git_client
(
login
,
password
,
project
:,
ip
:)
def
find_for_git_client
(
login
,
password
,
project
:,
ip
:)
raise
"Must provide an IP for rate limiting"
if
ip
.
nil?
raise
"Must provide an IP for rate limiting"
if
ip
.
nil?
...
@@ -57,7 +55,7 @@ module Gitlab
...
@@ -57,7 +55,7 @@ module Gitlab
if
user
.
nil?
||
user
.
ldap_user?
if
user
.
nil?
||
user
.
ldap_user?
# Second chance - try LDAP authentication
# Second chance - try LDAP authentication
Gitlab
::
LDAP
::
Authentication
.
login
(
login
,
password
)
Gitlab
::
LDAP
::
Authentication
.
login
(
login
,
password
)
elsif
current_application_s
ettings
.
password_authentication_enabled_for_git?
elsif
Gitlab
::
CurrentS
ettings
.
password_authentication_enabled_for_git?
user
if
user
.
active?
&&
user
.
valid_password?
(
password
)
user
if
user
.
active?
&&
user
.
valid_password?
(
password
)
end
end
end
end
...
@@ -87,7 +85,7 @@ module Gitlab
...
@@ -87,7 +85,7 @@ module Gitlab
private
private
def
authenticate_using_internal_or_ldap_password?
def
authenticate_using_internal_or_ldap_password?
current_application_s
ettings
.
password_authentication_enabled_for_git?
||
Gitlab
::
LDAP
::
Config
.
enabled?
Gitlab
::
CurrentS
ettings
.
password_authentication_enabled_for_git?
||
Gitlab
::
LDAP
::
Config
.
enabled?
end
end
def
service_request_check
(
login
,
password
,
project
)
def
service_request_check
(
login
,
password
,
project
)
...
...
lib/gitlab/current_settings.rb
View file @
eaada9d7
module
Gitlab
module
Gitlab
module
CurrentSettings
module
CurrentSettings
extend
self
class
<<
self
def
current_application_settings
def
current_application_settings
if
RequestStore
.
active?
if
RequestStore
.
active?
RequestStore
.
fetch
(
:current_application_settings
)
{
ensure_application_settings!
}
RequestStore
.
fetch
(
:current_application_settings
)
{
ensure_application_settings!
}
...
@@ -10,10 +9,16 @@ module Gitlab
...
@@ -10,10 +9,16 @@ module Gitlab
end
end
end
end
delegate
:sidekiq_throttling_enabled?
,
to: :current_application_settings
def
fake_application_settings
(
defaults
=
::
ApplicationSetting
.
defaults
)
def
fake_application_settings
(
defaults
=
::
ApplicationSetting
.
defaults
)
FakeApplicationSettings
.
new
(
defaults
)
Gitlab
::
FakeApplicationSettings
.
new
(
defaults
)
end
def
method_missing
(
name
,
*
args
,
&
block
)
current_application_settings
.
send
(
name
,
*
args
,
&
block
)
# rubocop:disable GitlabSecurity/PublicSend
end
def
respond_to_missing?
(
name
,
include_private
=
false
)
current_application_settings
.
respond_to?
(
name
,
include_private
)
||
super
end
end
private
private
...
@@ -70,4 +75,5 @@ module Gitlab
...
@@ -70,4 +75,5 @@ module Gitlab
false
false
end
end
end
end
end
end
end
lib/gitlab/gon_helper.rb
View file @
eaada9d7
...
@@ -3,12 +3,11 @@
...
@@ -3,12 +3,11 @@
module
Gitlab
module
Gitlab
module
GonHelper
module
GonHelper
include
WebpackHelper
include
WebpackHelper
include
Gitlab
::
CurrentSettings
def
add_gon_variables
def
add_gon_variables
gon
.
api_version
=
'v4'
gon
.
api_version
=
'v4'
gon
.
default_avatar_url
=
URI
.
join
(
Gitlab
.
config
.
gitlab
.
url
,
ActionController
::
Base
.
helpers
.
image_path
(
'no_avatar.png'
)).
to_s
gon
.
default_avatar_url
=
URI
.
join
(
Gitlab
.
config
.
gitlab
.
url
,
ActionController
::
Base
.
helpers
.
image_path
(
'no_avatar.png'
)).
to_s
gon
.
max_file_size
=
current_application_s
ettings
.
max_attachment_size
gon
.
max_file_size
=
Gitlab
::
CurrentS
ettings
.
max_attachment_size
gon
.
asset_host
=
ActionController
::
Base
.
asset_host
gon
.
asset_host
=
ActionController
::
Base
.
asset_host
gon
.
webpack_public_path
=
webpack_public_path
gon
.
webpack_public_path
=
webpack_public_path
gon
.
relative_url_root
=
Gitlab
.
config
.
gitlab
.
relative_url_root
gon
.
relative_url_root
=
Gitlab
.
config
.
gitlab
.
relative_url_root
...
@@ -16,7 +15,7 @@ module Gitlab
...
@@ -16,7 +15,7 @@ module Gitlab
gon
.
user_color_scheme
=
Gitlab
::
ColorSchemes
.
for_user
(
current_user
).
css_class
gon
.
user_color_scheme
=
Gitlab
::
ColorSchemes
.
for_user
(
current_user
).
css_class
gon
.
katex_css_url
=
ActionController
::
Base
.
helpers
.
asset_path
(
'katex.css'
)
gon
.
katex_css_url
=
ActionController
::
Base
.
helpers
.
asset_path
(
'katex.css'
)
gon
.
katex_js_url
=
ActionController
::
Base
.
helpers
.
asset_path
(
'katex.js'
)
gon
.
katex_js_url
=
ActionController
::
Base
.
helpers
.
asset_path
(
'katex.js'
)
gon
.
sentry_dsn
=
current_application_settings
.
clientside_sentry_dsn
if
current_application_s
ettings
.
clientside_sentry_enabled
gon
.
sentry_dsn
=
Gitlab
::
CurrentSettings
.
clientside_sentry_dsn
if
Gitlab
::
CurrentS
ettings
.
clientside_sentry_enabled
gon
.
gitlab_url
=
Gitlab
.
config
.
gitlab
.
url
gon
.
gitlab_url
=
Gitlab
.
config
.
gitlab
.
url
gon
.
revision
=
Gitlab
::
REVISION
gon
.
revision
=
Gitlab
::
REVISION
gon
.
gitlab_logo
=
ActionController
::
Base
.
helpers
.
asset_path
(
'gitlab_logo.png'
)
gon
.
gitlab_logo
=
ActionController
::
Base
.
helpers
.
asset_path
(
'gitlab_logo.png'
)
...
...
lib/gitlab/legacy_github_import/project_creator.rb
View file @
eaada9d7
module
Gitlab
module
Gitlab
module
LegacyGithubImport
module
LegacyGithubImport
class
ProjectCreator
class
ProjectCreator
include
Gitlab
::
CurrentSettings
attr_reader
:repo
,
:name
,
:namespace
,
:current_user
,
:session_data
,
:type
attr_reader
:repo
,
:name
,
:namespace
,
:current_user
,
:session_data
,
:type
def
initialize
(
repo
,
name
,
namespace
,
current_user
,
session_data
,
type:
'github'
)
def
initialize
(
repo
,
name
,
namespace
,
current_user
,
session_data
,
type:
'github'
)
...
@@ -36,7 +34,7 @@ module Gitlab
...
@@ -36,7 +34,7 @@ module Gitlab
end
end
def
visibility_level
def
visibility_level
repo
.
private
?
Gitlab
::
VisibilityLevel
::
PRIVATE
:
current_application_s
ettings
.
default_project_visibility
repo
.
private
?
Gitlab
::
VisibilityLevel
::
PRIVATE
:
Gitlab
::
CurrentS
ettings
.
default_project_visibility
end
end
#
#
...
...
lib/gitlab/metrics/prometheus.rb
View file @
eaada9d7
...
@@ -71,8 +71,7 @@ module Gitlab
...
@@ -71,8 +71,7 @@ module Gitlab
end
end
def
prometheus_metrics_enabled_unmemoized
def
prometheus_metrics_enabled_unmemoized
metrics_folder_present?
&&
metrics_folder_present?
&&
Gitlab
::
CurrentSettings
.
prometheus_metrics_enabled
||
false
Gitlab
::
CurrentSettings
.
current_application_settings
[
:prometheus_metrics_enabled
]
||
false
end
end
end
end
end
end
...
...
lib/gitlab/middleware/go.rb
View file @
eaada9d7
...
@@ -4,7 +4,6 @@ module Gitlab
...
@@ -4,7 +4,6 @@ module Gitlab
module
Middleware
module
Middleware
class
Go
class
Go
include
ActionView
::
Helpers
::
TagHelper
include
ActionView
::
Helpers
::
TagHelper
include
Gitlab
::
CurrentSettings
PROJECT_PATH_REGEX
=
%r{
\A
(
#{
Gitlab
::
PathRegex
.
full_namespace_route_regex
}
/
#{
Gitlab
::
PathRegex
.
project_route_regex
}
)/}
.
freeze
PROJECT_PATH_REGEX
=
%r{
\A
(
#{
Gitlab
::
PathRegex
.
full_namespace_route_regex
}
/
#{
Gitlab
::
PathRegex
.
project_route_regex
}
)/}
.
freeze
...
@@ -42,7 +41,7 @@ module Gitlab
...
@@ -42,7 +41,7 @@ module Gitlab
project_url
=
URI
.
join
(
config
.
gitlab
.
url
,
path
)
project_url
=
URI
.
join
(
config
.
gitlab
.
url
,
path
)
import_prefix
=
strip_url
(
project_url
.
to_s
)
import_prefix
=
strip_url
(
project_url
.
to_s
)
repository_url
=
if
current_application_s
ettings
.
enabled_git_access_protocol
==
'ssh'
repository_url
=
if
Gitlab
::
CurrentS
ettings
.
enabled_git_access_protocol
==
'ssh'
shell
=
config
.
gitlab_shell
shell
=
config
.
gitlab_shell
port
=
":
#{
shell
.
ssh_port
}
"
unless
shell
.
ssh_port
==
22
port
=
":
#{
shell
.
ssh_port
}
"
unless
shell
.
ssh_port
==
22
"ssh://
#{
shell
.
ssh_user
}
@
#{
shell
.
ssh_host
}#{
port
}
/
#{
path
}
.git"
"ssh://
#{
shell
.
ssh_user
}
@
#{
shell
.
ssh_host
}#{
port
}
/
#{
path
}
.git"
...
...
lib/gitlab/performance_bar.rb
View file @
eaada9d7
module
Gitlab
module
Gitlab
module
PerformanceBar
module
PerformanceBar
extend
Gitlab
::
CurrentSettings
ALLOWED_USER_IDS_KEY
=
'performance_bar_allowed_user_ids:v2'
.
freeze
ALLOWED_USER_IDS_KEY
=
'performance_bar_allowed_user_ids:v2'
.
freeze
EXPIRY_TIME
=
5
.
minutes
EXPIRY_TIME
=
5
.
minutes
...
@@ -13,7 +11,7 @@ module Gitlab
...
@@ -13,7 +11,7 @@ module Gitlab
end
end
def
self
.
allowed_group_id
def
self
.
allowed_group_id
current_application_s
ettings
.
performance_bar_allowed_group_id
Gitlab
::
CurrentS
ettings
.
performance_bar_allowed_group_id
end
end
def
self
.
allowed_user_ids
def
self
.
allowed_user_ids
...
...
lib/gitlab/polling_interval.rb
View file @
eaada9d7
module
Gitlab
module
Gitlab
class
PollingInterval
class
PollingInterval
extend
Gitlab
::
CurrentSettings
HEADER_NAME
=
'Poll-Interval'
.
freeze
HEADER_NAME
=
'Poll-Interval'
.
freeze
def
self
.
set_header
(
response
,
interval
:)
def
self
.
set_header
(
response
,
interval
:)
if
polling_enabled?
if
polling_enabled?
multiplier
=
current_application_s
ettings
.
polling_interval_multiplier
multiplier
=
Gitlab
::
CurrentS
ettings
.
polling_interval_multiplier
value
=
(
interval
*
multiplier
).
to_i
value
=
(
interval
*
multiplier
).
to_i
else
else
value
=
-
1
value
=
-
1
...
@@ -16,7 +14,7 @@ module Gitlab
...
@@ -16,7 +14,7 @@ module Gitlab
end
end
def
self
.
polling_enabled?
def
self
.
polling_enabled?
!
current_application_s
ettings
.
polling_interval_multiplier
.
zero?
!
Gitlab
::
CurrentS
ettings
.
polling_interval_multiplier
.
zero?
end
end
end
end
end
end
lib/gitlab/protocol_access.rb
View file @
eaada9d7
module
Gitlab
module
Gitlab
module
ProtocolAccess
module
ProtocolAccess
extend
Gitlab
::
CurrentSettings
def
self
.
allowed?
(
protocol
)
def
self
.
allowed?
(
protocol
)
if
protocol
==
'web'
if
protocol
==
'web'
true
true
elsif
current_application_s
ettings
.
enabled_git_access_protocol
.
blank?
elsif
Gitlab
::
CurrentS
ettings
.
enabled_git_access_protocol
.
blank?
true
true
else
else
protocol
==
current_application_s
ettings
.
enabled_git_access_protocol
protocol
==
Gitlab
::
CurrentS
ettings
.
enabled_git_access_protocol
end
end
end
end
end
end
...
...
lib/gitlab/recaptcha.rb
View file @
eaada9d7
module
Gitlab
module
Gitlab
module
Recaptcha
module
Recaptcha
extend
Gitlab
::
CurrentSettings
def
self
.
load_configurations!
def
self
.
load_configurations!
if
current_application_s
ettings
.
recaptcha_enabled
if
Gitlab
::
CurrentS
ettings
.
recaptcha_enabled
::
Recaptcha
.
configure
do
|
config
|
::
Recaptcha
.
configure
do
|
config
|
config
.
public_key
=
current_application_s
ettings
.
recaptcha_site_key
config
.
public_key
=
Gitlab
::
CurrentS
ettings
.
recaptcha_site_key
config
.
private_key
=
current_application_s
ettings
.
recaptcha_private_key
config
.
private_key
=
Gitlab
::
CurrentS
ettings
.
recaptcha_private_key
end
end
true
true
...
@@ -14,7 +12,7 @@ module Gitlab
...
@@ -14,7 +12,7 @@ module Gitlab
end
end
def
self
.
enabled?
def
self
.
enabled?
current_application_s
ettings
.
recaptcha_enabled
Gitlab
::
CurrentS
ettings
.
recaptcha_enabled
end
end
end
end
end
end
lib/gitlab/sentry.rb
View file @
eaada9d7
module
Gitlab
module
Gitlab
module
Sentry
module
Sentry
extend
Gitlab
::
CurrentSettings
def
self
.
enabled?
def
self
.
enabled?
Rails
.
env
.
production?
&&
current_application_s
ettings
.
sentry_enabled?
Rails
.
env
.
production?
&&
Gitlab
::
CurrentS
ettings
.
sentry_enabled?
end
end
def
self
.
context
(
current_user
=
nil
)
def
self
.
context
(
current_user
=
nil
)
...
...
lib/gitlab/usage_data.rb
View file @
eaada9d7
module
Gitlab
module
Gitlab
class
UsageData
class
UsageData
class
<<
self
class
<<
self
include
Gitlab
::
CurrentSettings
def
data
(
force_refresh:
false
)
def
data
(
force_refresh:
false
)
Rails
.
cache
.
fetch
(
'usage_data'
,
force:
force_refresh
,
expires_in:
2
.
weeks
)
{
uncached_data
}
Rails
.
cache
.
fetch
(
'usage_data'
,
force:
force_refresh
,
expires_in:
2
.
weeks
)
{
uncached_data
}
end
end
...
@@ -19,7 +17,7 @@ module Gitlab
...
@@ -19,7 +17,7 @@ module Gitlab
def
license_usage_data
def
license_usage_data
usage_data
=
{
usage_data
=
{
uuid:
current_application_s
ettings
.
uuid
,
uuid:
Gitlab
::
CurrentS
ettings
.
uuid
,
hostname:
Gitlab
.
config
.
gitlab
.
host
,
hostname:
Gitlab
.
config
.
gitlab
.
host
,
version:
Gitlab
::
VERSION
,
version:
Gitlab
::
VERSION
,
active_user_count:
User
.
active
.
count
,
active_user_count:
User
.
active
.
count
,
...
@@ -79,9 +77,9 @@ module Gitlab
...
@@ -79,9 +77,9 @@ module Gitlab
def
features_usage_data_ce
def
features_usage_data_ce
{
{
signup:
current_application_s
ettings
.
allow_signup?
,
signup:
Gitlab
::
CurrentS
ettings
.
allow_signup?
,
ldap:
Gitlab
.
config
.
ldap
.
enabled
,
ldap:
Gitlab
.
config
.
ldap
.
enabled
,
gravatar:
current_application_s
ettings
.
gravatar_enabled?
,
gravatar:
Gitlab
::
CurrentS
ettings
.
gravatar_enabled?
,
omniauth:
Gitlab
.
config
.
omniauth
.
enabled
,
omniauth:
Gitlab
.
config
.
omniauth
.
enabled
,
reply_by_email:
Gitlab
::
IncomingEmail
.
enabled?
,
reply_by_email:
Gitlab
::
IncomingEmail
.
enabled?
,
container_registry:
Gitlab
.
config
.
registry
.
enabled
,
container_registry:
Gitlab
.
config
.
registry
.
enabled
,
...
...
lib/gitlab/visibility_level.rb
View file @
eaada9d7
...
@@ -5,7 +5,6 @@
...
@@ -5,7 +5,6 @@
#
#
module
Gitlab
module
Gitlab
module
VisibilityLevel
module
VisibilityLevel
extend
CurrentSettings
extend
ActiveSupport
::
Concern
extend
ActiveSupport
::
Concern
included
do
included
do
...
@@ -58,7 +57,7 @@ module Gitlab
...
@@ -58,7 +57,7 @@ module Gitlab
end
end
def
allowed_levels
def
allowed_levels
restricted_levels
=
current_application_s
ettings
.
restricted_visibility_levels
restricted_levels
=
Gitlab
::
CurrentS
ettings
.
restricted_visibility_levels
self
.
values
-
restricted_levels
self
.
values
-
restricted_levels
end
end
...
@@ -81,7 +80,7 @@ module Gitlab
...
@@ -81,7 +80,7 @@ module Gitlab
end
end
def
non_restricted_level?
(
level
)
def
non_restricted_level?
(
level
)
restricted_levels
=
current_application_s
ettings
.
restricted_visibility_levels
restricted_levels
=
Gitlab
::
CurrentS
ettings
.
restricted_visibility_levels
if
restricted_levels
.
nil?
if
restricted_levels
.
nil?
true
true
...
...
spec/controllers/health_check_controller_spec.rb
View file @
eaada9d7
...
@@ -5,7 +5,7 @@ describe HealthCheckController do
...
@@ -5,7 +5,7 @@ describe HealthCheckController do
let
(
:json_response
)
{
JSON
.
parse
(
response
.
body
)
}
let
(
:json_response
)
{
JSON
.
parse
(
response
.
body
)
}
let
(
:xml_response
)
{
Hash
.
from_xml
(
response
.
body
)[
'hash'
]
}
let
(
:xml_response
)
{
Hash
.
from_xml
(
response
.
body
)[
'hash'
]
}
let
(
:token
)
{
current_application_s
ettings
.
health_check_access_token
}
let
(
:token
)
{
Gitlab
::
CurrentS
ettings
.
health_check_access_token
}
let
(
:whitelisted_ip
)
{
'127.0.0.1'
}
let
(
:whitelisted_ip
)
{
'127.0.0.1'
}
let
(
:not_whitelisted_ip
)
{
'127.0.0.2'
}
let
(
:not_whitelisted_ip
)
{
'127.0.0.2'
}
...
...
spec/controllers/health_controller_spec.rb
View file @
eaada9d7
...
@@ -4,7 +4,7 @@ describe HealthController do
...
@@ -4,7 +4,7 @@ describe HealthController do
include
StubENV
include
StubENV
let
(
:json_response
)
{
JSON
.
parse
(
response
.
body
)
}
let
(
:json_response
)
{
JSON
.
parse
(
response
.
body
)
}
let
(
:token
)
{
current_application_s
ettings
.
health_check_access_token
}
let
(
:token
)
{
Gitlab
::
CurrentS
ettings
.
health_check_access_token
}
let
(
:whitelisted_ip
)
{
'127.0.0.1'
}
let
(
:whitelisted_ip
)
{
'127.0.0.1'
}
let
(
:not_whitelisted_ip
)
{
'127.0.0.2'
}
let
(
:not_whitelisted_ip
)
{
'127.0.0.2'
}
...
...
spec/controllers/oauth/applications_controller_spec.rb
View file @
eaada9d7
...
@@ -16,8 +16,7 @@ describe Oauth::ApplicationsController do
...
@@ -16,8 +16,7 @@ describe Oauth::ApplicationsController do
end
end
it
'redirects back to profile page if OAuth applications are disabled'
do
it
'redirects back to profile page if OAuth applications are disabled'
do
settings
=
double
(
user_oauth_applications?:
false
)
allow
(
Gitlab
::
CurrentSettings
.
current_application_settings
).
to
receive
(
:user_oauth_applications?
).
and_return
(
false
)
allow_any_instance_of
(
Gitlab
::
CurrentSettings
).
to
receive
(
:current_application_settings
).
and_return
(
settings
)
get
:index
get
:index
...
...
spec/features/admin/admin_health_check_spec.rb
View file @
eaada9d7
...
@@ -17,7 +17,7 @@ feature "Admin Health Check", :feature do
...
@@ -17,7 +17,7 @@ feature "Admin Health Check", :feature do
page
.
has_text?
'Health Check'
page
.
has_text?
'Health Check'
page
.
has_text?
'Health information can be retrieved'
page
.
has_text?
'Health information can be retrieved'
token
=
current_application_s
ettings
.
health_check_access_token
token
=
Gitlab
::
CurrentS
ettings
.
health_check_access_token
expect
(
page
).
to
have_content
(
"Access token is
#{
token
}
"
)
expect
(
page
).
to
have_content
(
"Access token is
#{
token
}
"
)
expect
(
page
).
to
have_selector
(
'#health-check-token'
,
text:
token
)
expect
(
page
).
to
have_selector
(
'#health-check-token'
,
text:
token
)
...
@@ -25,7 +25,7 @@ feature "Admin Health Check", :feature do
...
@@ -25,7 +25,7 @@ feature "Admin Health Check", :feature do
describe
'reload access token'
do
describe
'reload access token'
do
it
'changes the access token'
do
it
'changes the access token'
do
orig_token
=
current_application_s
ettings
.
health_check_access_token
orig_token
=
Gitlab
::
CurrentS
ettings
.
health_check_access_token
click_button
'Reset health check access token'
click_button
'Reset health check access token'
expect
(
page
).
to
have_content
(
'New health check access token has been generated!'
)
expect
(
page
).
to
have_content
(
'New health check access token has been generated!'
)
...
...
spec/features/admin/admin_runners_spec.rb
View file @
eaada9d7
...
@@ -156,7 +156,7 @@ describe "Admin Runners" do
...
@@ -156,7 +156,7 @@ describe "Admin Runners" do
end
end
describe
'runners registration token'
do
describe
'runners registration token'
do
let!
(
:token
)
{
current_application_s
ettings
.
runners_registration_token
}
let!
(
:token
)
{
Gitlab
::
CurrentS
ettings
.
runners_registration_token
}
before
do
before
do
visit
admin_runners_path
visit
admin_runners_path
...
...
spec/features/admin/admin_settings_spec.rb
View file @
eaada9d7
...
@@ -38,12 +38,12 @@ feature 'Admin updates settings' do
...
@@ -38,12 +38,12 @@ feature 'Admin updates settings' do
uncheck
'Project export enabled'
uncheck
'Project export enabled'
click_button
'Save'
click_button
'Save'
expect
(
current_application_s
ettings
.
gravatar_enabled
).
to
be_falsey
expect
(
Gitlab
::
CurrentS
ettings
.
gravatar_enabled
).
to
be_falsey
expect
(
current_application_s
ettings
.
home_page_url
).
to
eq
"https://about.gitlab.com/"
expect
(
Gitlab
::
CurrentS
ettings
.
home_page_url
).
to
eq
"https://about.gitlab.com/"
expect
(
current_application_s
ettings
.
help_page_text
).
to
eq
"Example text"
expect
(
Gitlab
::
CurrentS
ettings
.
help_page_text
).
to
eq
"Example text"
expect
(
current_application_s
ettings
.
help_page_hide_commercial_content
).
to
be_truthy
expect
(
Gitlab
::
CurrentS
ettings
.
help_page_hide_commercial_content
).
to
be_truthy
expect
(
current_application_s
ettings
.
help_page_support_url
).
to
eq
"http://example.com/help"
expect
(
Gitlab
::
CurrentS
ettings
.
help_page_support_url
).
to
eq
"http://example.com/help"
expect
(
current_application_s
ettings
.
project_export_enabled
).
to
be_falsey
expect
(
Gitlab
::
CurrentS
ettings
.
project_export_enabled
).
to
be_falsey
expect
(
page
).
to
have_content
"Application settings saved successfully"
expect
(
page
).
to
have_content
"Application settings saved successfully"
end
end
...
...
spec/features/issues/spam_issues_spec.rb
View file @
eaada9d7
...
@@ -9,7 +9,7 @@ describe 'New issue', :js do
...
@@ -9,7 +9,7 @@ describe 'New issue', :js do
before
do
before
do
stub_env
(
'IN_MEMORY_APPLICATION_SETTINGS'
,
'false'
)
stub_env
(
'IN_MEMORY_APPLICATION_SETTINGS'
,
'false'
)
current_application_s
ettings
.
update!
(
Gitlab
::
CurrentS
ettings
.
update!
(
akismet_enabled:
true
,
akismet_enabled:
true
,
akismet_api_key:
'testkey'
,
akismet_api_key:
'testkey'
,
recaptcha_enabled:
true
,
recaptcha_enabled:
true
,
...
...
spec/helpers/version_check_helper_spec.rb
View file @
eaada9d7
...
@@ -4,7 +4,7 @@ describe VersionCheckHelper do
...
@@ -4,7 +4,7 @@ describe VersionCheckHelper do
describe
'#version_status_badge'
do
describe
'#version_status_badge'
do
it
'should return nil if not dev environment and not enabled'
do
it
'should return nil if not dev environment and not enabled'
do
allow
(
Rails
.
env
).
to
receive
(
:production?
)
{
false
}
allow
(
Rails
.
env
).
to
receive
(
:production?
)
{
false
}
allow
(
helper
.
current_application_settings
).
to
receive
(
:version_check_enabled
)
{
false
}
allow
(
Gitlab
::
CurrentSettings
.
current_application_settings
).
to
receive
(
:version_check_enabled
)
{
false
}
expect
(
helper
.
version_status_badge
).
to
be
(
nil
)
expect
(
helper
.
version_status_badge
).
to
be
(
nil
)
end
end
...
@@ -12,7 +12,7 @@ describe VersionCheckHelper do
...
@@ -12,7 +12,7 @@ describe VersionCheckHelper do
context
'when production and enabled'
do
context
'when production and enabled'
do
before
do
before
do
allow
(
Rails
.
env
).
to
receive
(
:production?
)
{
true
}
allow
(
Rails
.
env
).
to
receive
(
:production?
)
{
true
}
allow
(
helper
.
current_application_settings
).
to
receive
(
:version_check_enabled
)
{
true
}
allow
(
Gitlab
::
CurrentSettings
.
current_application_settings
).
to
receive
(
:version_check_enabled
)
{
true
}
allow_any_instance_of
(
VersionCheck
).
to
receive
(
:url
)
{
'https://version.host.com/check.svg?gitlab_info=xxx'
}
allow_any_instance_of
(
VersionCheck
).
to
receive
(
:url
)
{
'https://version.host.com/check.svg?gitlab_info=xxx'
}
@image_tag
=
helper
.
version_status_badge
@image_tag
=
helper
.
version_status_badge
...
...
spec/lib/gitlab/current_settings_spec.rb
View file @
eaada9d7
...
@@ -8,22 +8,37 @@ describe Gitlab::CurrentSettings do
...
@@ -8,22 +8,37 @@ describe Gitlab::CurrentSettings do
end
end
describe
'#current_application_settings'
do
describe
'#current_application_settings'
do
it
'allows keys to be called directly'
do
db_settings
=
create
(
:application_setting
,
home_page_url:
'http://mydomain.com'
,
signup_enabled:
false
)
expect
(
described_class
.
home_page_url
).
to
eq
(
db_settings
.
home_page_url
)
expect
(
described_class
.
signup_enabled?
).
to
be_falsey
expect
(
described_class
.
signup_enabled
).
to
be_falsey
expect
(
described_class
.
metrics_sample_interval
).
to
be
(
15
)
end
context
'with DB available'
do
context
'with DB available'
do
before
do
before
do
allow_any_instance_of
(
described_class
).
to
receive
(
:connect_to_db?
).
and_return
(
true
)
# For some reason, `allow(described_class).to receive(:connect_to_db?).and_return(true)` causes issues
# during the initialization phase of the test suite, so instead let's mock the internals of it
allow
(
ActiveRecord
::
Base
.
connection
).
to
receive
(
:active?
).
and_return
(
true
)
allow
(
ActiveRecord
::
Base
.
connection
).
to
receive
(
:table_exists?
).
and_call_original
allow
(
ActiveRecord
::
Base
.
connection
).
to
receive
(
:table_exists?
).
with
(
'application_settings'
).
and_return
(
true
)
end
end
it
'attempts to use cached values first'
do
it
'attempts to use cached values first'
do
expect
(
ApplicationSetting
).
to
receive
(
:cached
)
expect
(
ApplicationSetting
).
to
receive
(
:cached
)
expect
(
current_application_settings
).
to
be_a
(
ApplicationSetting
)
expect
(
described_class
.
current_application_settings
).
to
be_a
(
ApplicationSetting
)
end
end
it
'falls back to DB if Redis returns an empty value'
do
it
'falls back to DB if Redis returns an empty value'
do
expect
(
ApplicationSetting
).
to
receive
(
:cached
).
and_return
(
nil
)
expect
(
ApplicationSetting
).
to
receive
(
:cached
).
and_return
(
nil
)
expect
(
ApplicationSetting
).
to
receive
(
:last
).
and_call_original
.
twice
expect
(
ApplicationSetting
).
to
receive
(
:last
).
and_call_original
.
twice
expect
(
current_application_settings
).
to
be_a
(
ApplicationSetting
)
expect
(
described_class
.
current_application_settings
).
to
be_a
(
ApplicationSetting
)
end
end
it
'falls back to DB if Redis fails'
do
it
'falls back to DB if Redis fails'
do
...
@@ -32,14 +47,14 @@ describe Gitlab::CurrentSettings do
...
@@ -32,14 +47,14 @@ describe Gitlab::CurrentSettings do
expect
(
ApplicationSetting
).
to
receive
(
:cached
).
and_raise
(
::
Redis
::
BaseError
)
expect
(
ApplicationSetting
).
to
receive
(
:cached
).
and_raise
(
::
Redis
::
BaseError
)
expect
(
Rails
.
cache
).
to
receive
(
:fetch
).
with
(
ApplicationSetting
::
CACHE_KEY
).
and_raise
(
Redis
::
BaseError
)
expect
(
Rails
.
cache
).
to
receive
(
:fetch
).
with
(
ApplicationSetting
::
CACHE_KEY
).
and_raise
(
Redis
::
BaseError
)
expect
(
current_application_settings
).
to
eq
(
db_settings
)
expect
(
described_class
.
current_application_settings
).
to
eq
(
db_settings
)
end
end
it
'creates default ApplicationSettings if none are present'
do
it
'creates default ApplicationSettings if none are present'
do
expect
(
ApplicationSetting
).
to
receive
(
:cached
).
and_raise
(
::
Redis
::
BaseError
)
expect
(
ApplicationSetting
).
to
receive
(
:cached
).
and_raise
(
::
Redis
::
BaseError
)
expect
(
Rails
.
cache
).
to
receive
(
:fetch
).
with
(
ApplicationSetting
::
CACHE_KEY
).
and_raise
(
Redis
::
BaseError
)
expect
(
Rails
.
cache
).
to
receive
(
:fetch
).
with
(
ApplicationSetting
::
CACHE_KEY
).
and_raise
(
Redis
::
BaseError
)
settings
=
current_application_settings
settings
=
described_class
.
current_application_settings
expect
(
settings
).
to
be_a
(
ApplicationSetting
)
expect
(
settings
).
to
be_a
(
ApplicationSetting
)
expect
(
settings
).
to
be_persisted
expect
(
settings
).
to
be_persisted
...
@@ -52,7 +67,7 @@ describe Gitlab::CurrentSettings do
...
@@ -52,7 +67,7 @@ describe Gitlab::CurrentSettings do
end
end
it
'returns an in-memory ApplicationSetting object'
do
it
'returns an in-memory ApplicationSetting object'
do
settings
=
current_application_settings
settings
=
described_class
.
current_application_settings
expect
(
settings
).
to
be_a
(
OpenStruct
)
expect
(
settings
).
to
be_a
(
OpenStruct
)
expect
(
settings
.
sign_in_enabled?
).
to
eq
(
settings
.
sign_in_enabled
)
expect
(
settings
.
sign_in_enabled?
).
to
eq
(
settings
.
sign_in_enabled
)
...
@@ -63,7 +78,7 @@ describe Gitlab::CurrentSettings do
...
@@ -63,7 +78,7 @@ describe Gitlab::CurrentSettings do
db_settings
=
create
(
:application_setting
,
db_settings
=
create
(
:application_setting
,
home_page_url:
'http://mydomain.com'
,
home_page_url:
'http://mydomain.com'
,
signup_enabled:
false
)
signup_enabled:
false
)
settings
=
current_application_settings
settings
=
described_class
.
current_application_settings
app_defaults
=
ApplicationSetting
.
last
app_defaults
=
ApplicationSetting
.
last
expect
(
settings
).
to
be_a
(
OpenStruct
)
expect
(
settings
).
to
be_a
(
OpenStruct
)
...
@@ -80,15 +95,16 @@ describe Gitlab::CurrentSettings do
...
@@ -80,15 +95,16 @@ describe Gitlab::CurrentSettings do
context
'with DB unavailable'
do
context
'with DB unavailable'
do
before
do
before
do
allow_any_instance_of
(
described_class
).
to
receive
(
:connect_to_db?
).
and_return
(
false
)
# For some reason, `allow(described_class).to receive(:connect_to_db?).and_return(false)` causes issues
allow_any_instance_of
(
described_class
).
to
receive
(
:retrieve_settings_from_database_cache?
).
and_return
(
nil
)
# during the initialization phase of the test suite, so instead let's mock the internals of it
allow
(
ActiveRecord
::
Base
.
connection
).
to
receive
(
:active?
).
and_return
(
false
)
end
end
it
'returns an in-memory ApplicationSetting object'
do
it
'returns an in-memory ApplicationSetting object'
do
expect
(
ApplicationSetting
).
not_to
receive
(
:current
)
expect
(
ApplicationSetting
).
not_to
receive
(
:current
)
expect
(
ApplicationSetting
).
not_to
receive
(
:last
)
expect
(
ApplicationSetting
).
not_to
receive
(
:last
)
expect
(
current_application_settings
).
to
be_a
(
OpenStruct
)
expect
(
described_class
.
current_application_settings
).
to
be_a
(
OpenStruct
)
end
end
end
end
...
@@ -101,8 +117,8 @@ describe Gitlab::CurrentSettings do
...
@@ -101,8 +117,8 @@ describe Gitlab::CurrentSettings do
expect
(
ApplicationSetting
).
not_to
receive
(
:current
)
expect
(
ApplicationSetting
).
not_to
receive
(
:current
)
expect
(
ApplicationSetting
).
not_to
receive
(
:last
)
expect
(
ApplicationSetting
).
not_to
receive
(
:last
)
expect
(
current_application_settings
).
to
be_a
(
ApplicationSetting
)
expect
(
described_class
.
current_application_settings
).
to
be_a
(
ApplicationSetting
)
expect
(
current_application_settings
).
not_to
be_persisted
expect
(
described_class
.
current_application_settings
).
not_to
be_persisted
end
end
end
end
end
end
...
...
spec/lib/gitlab/metrics_spec.rb
View file @
eaada9d7
...
@@ -20,7 +20,7 @@ describe Gitlab::Metrics do
...
@@ -20,7 +20,7 @@ describe Gitlab::Metrics do
context
'prometheus metrics enabled in config'
do
context
'prometheus metrics enabled in config'
do
before
do
before
do
allow
(
Gitlab
::
CurrentSettings
).
to
receive
(
:
current_application_settings
).
and_return
(
prometheus_metrics_enabled:
true
)
allow
(
Gitlab
::
CurrentSettings
).
to
receive
(
:
prometheus_metrics_enabled
).
and_return
(
true
)
end
end
context
'when metrics folder is present'
do
context
'when metrics folder is present'
do
...
...
spec/lib/gitlab/usage_data_spec.rb
View file @
eaada9d7
...
@@ -103,9 +103,9 @@ describe Gitlab::UsageData do
...
@@ -103,9 +103,9 @@ describe Gitlab::UsageData do
subject
{
described_class
.
features_usage_data_ce
}
subject
{
described_class
.
features_usage_data_ce
}
it
'gathers feature usage data'
do
it
'gathers feature usage data'
do
expect
(
subject
[
:signup
]).
to
eq
(
current_application_s
ettings
.
allow_signup?
)
expect
(
subject
[
:signup
]).
to
eq
(
Gitlab
::
CurrentS
ettings
.
allow_signup?
)
expect
(
subject
[
:ldap
]).
to
eq
(
Gitlab
.
config
.
ldap
.
enabled
)
expect
(
subject
[
:ldap
]).
to
eq
(
Gitlab
.
config
.
ldap
.
enabled
)
expect
(
subject
[
:gravatar
]).
to
eq
(
current_application_s
ettings
.
gravatar_enabled?
)
expect
(
subject
[
:gravatar
]).
to
eq
(
Gitlab
::
CurrentS
ettings
.
gravatar_enabled?
)
expect
(
subject
[
:omniauth
]).
to
eq
(
Gitlab
.
config
.
omniauth
.
enabled
)
expect
(
subject
[
:omniauth
]).
to
eq
(
Gitlab
.
config
.
omniauth
.
enabled
)
expect
(
subject
[
:reply_by_email
]).
to
eq
(
Gitlab
::
IncomingEmail
.
enabled?
)
expect
(
subject
[
:reply_by_email
]).
to
eq
(
Gitlab
::
IncomingEmail
.
enabled?
)
expect
(
subject
[
:container_registry
]).
to
eq
(
Gitlab
.
config
.
registry
.
enabled
)
expect
(
subject
[
:container_registry
]).
to
eq
(
Gitlab
.
config
.
registry
.
enabled
)
...
@@ -129,7 +129,7 @@ describe Gitlab::UsageData do
...
@@ -129,7 +129,7 @@ describe Gitlab::UsageData do
subject
{
described_class
.
license_usage_data
}
subject
{
described_class
.
license_usage_data
}
it
"gathers license data"
do
it
"gathers license data"
do
expect
(
subject
[
:uuid
]).
to
eq
(
current_application_s
ettings
.
uuid
)
expect
(
subject
[
:uuid
]).
to
eq
(
Gitlab
::
CurrentS
ettings
.
uuid
)
expect
(
subject
[
:version
]).
to
eq
(
Gitlab
::
VERSION
)
expect
(
subject
[
:version
]).
to
eq
(
Gitlab
::
VERSION
)
expect
(
subject
[
:active_user_count
]).
to
eq
(
User
.
active
.
count
)
expect
(
subject
[
:active_user_count
]).
to
eq
(
User
.
active
.
count
)
expect
(
subject
[
:recorded_at
]).
to
be_a
(
Time
)
expect
(
subject
[
:recorded_at
]).
to
be_a
(
Time
)
...
...
spec/models/key_spec.rb
View file @
eaada9d7
require
'spec_helper'
require
'spec_helper'
describe
Key
,
:mailer
do
describe
Key
,
:mailer
do
include
Gitlab
::
CurrentSettings
describe
'modules'
do
subject
{
described_class
}
it
{
is_expected
.
to
include_module
(
Gitlab
::
CurrentSettings
)
}
end
describe
"Associations"
do
describe
"Associations"
do
it
{
is_expected
.
to
belong_to
(
:user
)
}
it
{
is_expected
.
to
belong_to
(
:user
)
}
end
end
...
...
spec/models/note_spec.rb
View file @
eaada9d7
...
@@ -17,8 +17,6 @@ describe Note do
...
@@ -17,8 +17,6 @@ describe Note do
it
{
is_expected
.
to
include_module
(
Participable
)
}
it
{
is_expected
.
to
include_module
(
Participable
)
}
it
{
is_expected
.
to
include_module
(
Mentionable
)
}
it
{
is_expected
.
to
include_module
(
Mentionable
)
}
it
{
is_expected
.
to
include_module
(
Awardable
)
}
it
{
is_expected
.
to
include_module
(
Awardable
)
}
it
{
is_expected
.
to
include_module
(
Gitlab
::
CurrentSettings
)
}
end
end
describe
'validation'
do
describe
'validation'
do
...
...
spec/models/project_spec.rb
View file @
eaada9d7
...
@@ -117,7 +117,6 @@ describe Project do
...
@@ -117,7 +117,6 @@ describe Project do
it
{
is_expected
.
to
include_module
(
Gitlab
::
ConfigHelper
)
}
it
{
is_expected
.
to
include_module
(
Gitlab
::
ConfigHelper
)
}
it
{
is_expected
.
to
include_module
(
Gitlab
::
ShellAdapter
)
}
it
{
is_expected
.
to
include_module
(
Gitlab
::
ShellAdapter
)
}
it
{
is_expected
.
to
include_module
(
Gitlab
::
VisibilityLevel
)
}
it
{
is_expected
.
to
include_module
(
Gitlab
::
VisibilityLevel
)
}
it
{
is_expected
.
to
include_module
(
Gitlab
::
CurrentSettings
)
}
it
{
is_expected
.
to
include_module
(
Referable
)
}
it
{
is_expected
.
to
include_module
(
Referable
)
}
it
{
is_expected
.
to
include_module
(
Sortable
)
}
it
{
is_expected
.
to
include_module
(
Sortable
)
}
end
end
...
...
spec/models/user_spec.rb
View file @
eaada9d7
require
'spec_helper'
require
'spec_helper'
describe
User
do
describe
User
do
include
Gitlab
::
CurrentSettings
include
ProjectForksHelper
include
ProjectForksHelper
describe
'modules'
do
describe
'modules'
do
subject
{
described_class
}
subject
{
described_class
}
it
{
is_expected
.
to
include_module
(
Gitlab
::
ConfigHelper
)
}
it
{
is_expected
.
to
include_module
(
Gitlab
::
ConfigHelper
)
}
it
{
is_expected
.
to
include_module
(
Gitlab
::
CurrentSettings
)
}
it
{
is_expected
.
to
include_module
(
Referable
)
}
it
{
is_expected
.
to
include_module
(
Referable
)
}
it
{
is_expected
.
to
include_module
(
Sortable
)
}
it
{
is_expected
.
to
include_module
(
Sortable
)
}
it
{
is_expected
.
to
include_module
(
TokenAuthenticatable
)
}
it
{
is_expected
.
to
include_module
(
TokenAuthenticatable
)
}
...
@@ -560,7 +558,7 @@ describe User do
...
@@ -560,7 +558,7 @@ describe User do
stub_config_setting
(
default_can_create_group:
true
)
stub_config_setting
(
default_can_create_group:
true
)
expect
{
user
.
update_attributes
(
external:
false
)
}.
to
change
{
user
.
can_create_group
}.
to
(
true
)
expect
{
user
.
update_attributes
(
external:
false
)
}.
to
change
{
user
.
can_create_group
}.
to
(
true
)
.
and
change
{
user
.
projects_limit
}.
to
(
current_application_s
ettings
.
default_projects_limit
)
.
and
change
{
user
.
projects_limit
}.
to
(
Gitlab
::
CurrentS
ettings
.
default_projects_limit
)
end
end
end
end
...
@@ -826,7 +824,7 @@ describe User do
...
@@ -826,7 +824,7 @@ describe User do
end
end
end
end
context
'when
current_application_s
ettings.user_default_external is true'
do
context
'when
Gitlab::CurrentS
ettings.user_default_external is true'
do
before
do
before
do
stub_application_setting
(
user_default_external:
true
)
stub_application_setting
(
user_default_external:
true
)
end
end
...
...
spec/requests/api/projects_spec.rb
View file @
eaada9d7
...
@@ -2,8 +2,6 @@
...
@@ -2,8 +2,6 @@
require
'spec_helper'
require
'spec_helper'
describe
API
::
Projects
do
describe
API
::
Projects
do
include
Gitlab
::
CurrentSettings
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:user2
)
{
create
(
:user
)
}
let
(
:user2
)
{
create
(
:user
)
}
let
(
:user3
)
{
create
(
:user
)
}
let
(
:user3
)
{
create
(
:user
)
}
...
...
spec/requests/api/v3/projects_spec.rb
View file @
eaada9d7
require
'spec_helper'
require
'spec_helper'
describe
API
::
V3
::
Projects
do
describe
API
::
V3
::
Projects
do
include
Gitlab
::
CurrentSettings
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:user2
)
{
create
(
:user
)
}
let
(
:user2
)
{
create
(
:user
)
}
let
(
:user3
)
{
create
(
:user
)
}
let
(
:user3
)
{
create
(
:user
)
}
...
...
spec/support/stored_repositories.rb
View file @
eaada9d7
...
@@ -15,9 +15,7 @@ RSpec.configure do |config|
...
@@ -15,9 +15,7 @@ RSpec.configure do |config|
# Track the maximum number of failures
# Track the maximum number of failures
first_failure
=
Time
.
parse
(
"2017-11-14 17:52:30"
)
first_failure
=
Time
.
parse
(
"2017-11-14 17:52:30"
)
last_failure
=
Time
.
parse
(
"2017-11-14 18:54:37"
)
last_failure
=
Time
.
parse
(
"2017-11-14 18:54:37"
)
failure_count
=
Gitlab
::
CurrentSettings
failure_count
=
Gitlab
::
CurrentSettings
.
circuitbreaker_failure_count_threshold
+
1
.
current_application_settings
.
circuitbreaker_failure_count_threshold
+
1
cache_key
=
"
#{
Gitlab
::
Git
::
Storage
::
REDIS_KEY_PREFIX
}
broken:
#{
Gitlab
::
Environment
.
hostname
}
"
cache_key
=
"
#{
Gitlab
::
Git
::
Storage
::
REDIS_KEY_PREFIX
}
broken:
#{
Gitlab
::
Environment
.
hostname
}
"
Gitlab
::
Git
::
Storage
.
redis
.
with
do
|
redis
|
Gitlab
::
Git
::
Storage
.
redis
.
with
do
|
redis
|
...
...
spec/support/stub_env.rb
View file @
eaada9d7
# Inspired by https://github.com/ljkbennett/stub_env/blob/master/lib/stub_env/helpers.rb
# Inspired by https://github.com/ljkbennett/stub_env/blob/master/lib/stub_env/helpers.rb
module
StubENV
module
StubENV
include
Gitlab
::
CurrentSettings
def
stub_env
(
key_or_hash
,
value
=
nil
)
def
stub_env
(
key_or_hash
,
value
=
nil
)
init_stub
unless
env_stubbed?
init_stub
unless
env_stubbed?
...
...
spec/support/unique_ip_check_shared_examples.rb
View file @
eaada9d7
...
@@ -9,7 +9,7 @@ shared_context 'unique ips sign in limit' do
...
@@ -9,7 +9,7 @@ shared_context 'unique ips sign in limit' do
before
do
before
do
stub_env
(
'IN_MEMORY_APPLICATION_SETTINGS'
,
'false'
)
stub_env
(
'IN_MEMORY_APPLICATION_SETTINGS'
,
'false'
)
current_application_s
ettings
.
update!
(
Gitlab
::
CurrentS
ettings
.
update!
(
unique_ips_limit_enabled:
true
,
unique_ips_limit_enabled:
true
,
unique_ips_limit_time_window:
10000
unique_ips_limit_time_window:
10000
)
)
...
@@ -34,7 +34,7 @@ end
...
@@ -34,7 +34,7 @@ end
shared_examples
'user login operation with unique ip limit'
do
shared_examples
'user login operation with unique ip limit'
do
include_context
'unique ips sign in limit'
do
include_context
'unique ips sign in limit'
do
before
do
before
do
current_application_s
ettings
.
update!
(
unique_ips_limit_per_user:
1
)
Gitlab
::
CurrentS
ettings
.
update!
(
unique_ips_limit_per_user:
1
)
end
end
it
'allows user authenticating from the same ip'
do
it
'allows user authenticating from the same ip'
do
...
@@ -52,7 +52,7 @@ end
...
@@ -52,7 +52,7 @@ end
shared_examples
'user login request with unique ip limit'
do
|
success_status
=
200
|
shared_examples
'user login request with unique ip limit'
do
|
success_status
=
200
|
include_context
'unique ips sign in limit'
do
include_context
'unique ips sign in limit'
do
before
do
before
do
current_application_s
ettings
.
update!
(
unique_ips_limit_per_user:
1
)
Gitlab
::
CurrentS
ettings
.
update!
(
unique_ips_limit_per_user:
1
)
end
end
it
'allows user authenticating from the same ip'
do
it
'allows user authenticating from the same ip'
do
...
...
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