Открыть боковую панель
nt_test134
nt_project_qgddddf2ot8w
Коммиты
4a50e1f0
Коммит
4a50e1f0
создал
Июн 01, 2016
по автору
Douwe Maan
Просмотр файлов
Merge branch 'current-settings-use-request-store-during-request'
владельцы
c0f19cc9
c8eb1dcc
Изменения
8
Скрыть пробелы
Построчно
Рядом
CHANGELOG
Просмотр файла @
4a50e1f0
...
@@ -27,6 +27,7 @@ v 8.8.3
...
@@ -27,6 +27,7 @@ v 8.8.3
- Fix gitlab importer failing to import new projects due to missing credentials
- Fix gitlab importer failing to import new projects due to missing credentials
- Fix import URL migration not rescuing with the correct Error
- Fix import URL migration not rescuing with the correct Error
- In search results, only show notes on confidential issues that the user has access to
- In search results, only show notes on confidential issues that the user has access to
- Fix health check access token changing due to old application settings being used
v 8.8.2
v 8.8.2
- Added remove due date button. !4209
- Added remove due date button. !4209
...
...
app/models/application_setting.rb
Просмотр файла @
4a50e1f0
...
@@ -102,6 +102,10 @@ def self.expire
...
@@ -102,6 +102,10 @@ def self.expire
Rails
.
cache
.
delete
(
CACHE_KEY
)
Rails
.
cache
.
delete
(
CACHE_KEY
)
end
end
def
self
.
cached
Rails
.
cache
.
fetch
(
CACHE_KEY
)
end
def
self
.
create_from_defaults
def
self
.
create_from_defaults
create
(
create
(
default_projects_limit:
Settings
.
gitlab
[
'default_projects_limit'
],
default_projects_limit:
Settings
.
gitlab
[
'default_projects_limit'
],
...
...
lib/gitlab/current_settings.rb
Просмотр файла @
4a50e1f0
module
Gitlab
module
Gitlab
module
CurrentSettings
module
CurrentSettings
def
current_application_settings
def
current_application_settings
key
=
:current_application_settings
if
RequestStore
.
active?
RequestStore
.
fetch
(
:current_application_settings
)
{
ensure_application_settings!
}
RequestStore
.
store
[
key
]
||=
begin
else
settings
=
nil
ensure_application_settings!
end
end
if
connect_to_db?
def
ensure_application_settings!
settings
=
::
ApplicationSetting
.
current
settings
=
::
ApplicationSetting
.
cached
settings
||=
::
ApplicationSetting
.
create_from_defaults
unless
ActiveRecord
::
Migrator
.
needs_migration?
end
settings
||
fake_application_settings
if
!
settings
&&
connect_to_db?
settings
=
::
ApplicationSetting
.
current
settings
||=
::
ApplicationSetting
.
create_from_defaults
unless
ActiveRecord
::
Migrator
.
needs_migration?
end
end
settings
||
fake_application_settings
end
end
def
fake_application_settings
def
fake_application_settings
...
...
spec/controllers/registrations_controller_spec.rb
Просмотр файла @
4a50e1f0
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
let
(
:user_params
)
{
{
user:
{
name:
"new_user"
,
username:
"new_username"
,
email:
"new@user.com"
,
password:
"Any_password"
}
}
}
let
(
:user_params
)
{
{
user:
{
name:
"new_user"
,
username:
"new_username"
,
email:
"new@user.com"
,
password:
"Any_password"
}
}
}
context
'when sending email confirmation'
do
context
'when sending email confirmation'
do
before
{
allow
(
current_a
pplication
_s
etting
s
).
to
receive
(
:send_user_confirmation_email
).
and_return
(
false
)
}
before
{
allow
_any_instance_of
(
A
pplication
S
etting
).
to
receive
(
:send_user_confirmation_email
).
and_return
(
false
)
}
it
'logs user in directly'
do
it
'logs user in directly'
do
post
(
:create
,
user_params
)
post
(
:create
,
user_params
)
...
@@ -21,7 +21,7 @@
...
@@ -21,7 +21,7 @@
end
end
context
'when not sending email confirmation'
do
context
'when not sending email confirmation'
do
before
{
allow
(
current_a
pplication
_s
etting
s
).
to
receive
(
:send_user_confirmation_email
).
and_return
(
true
)
}
before
{
allow
_any_instance_of
(
A
pplication
S
etting
).
to
receive
(
:send_user_confirmation_email
).
and_return
(
true
)
}
it
'does not authenticate user and sends confirmation email'
do
it
'does not authenticate user and sends confirmation email'
do
post
(
:create
,
user_params
)
post
(
:create
,
user_params
)
...
...
spec/lib/gitlab/akismet_helper_spec.rb
Просмотр файла @
4a50e1f0
...
@@ -6,8 +6,8 @@
...
@@ -6,8 +6,8 @@
before
do
before
do
allow
(
Gitlab
.
config
.
gitlab
).
to
receive
(
:url
).
and_return
(
Settings
.
send
(
:build_gitlab_url
))
allow
(
Gitlab
.
config
.
gitlab
).
to
receive
(
:url
).
and_return
(
Settings
.
send
(
:build_gitlab_url
))
current_a
pplication
_s
etting
s
.
akismet_enabled
=
true
allow_any_instance_of
(
A
pplication
S
etting
).
to
receive
(
:
akismet_enabled
).
and_return
(
true
)
current_a
pplication
_s
etting
s
.
akismet_api_key
=
'12345'
allow_any_instance_of
(
A
pplication
S
etting
).
to
receive
(
:
akismet_api_key
).
and_return
(
'12345'
)
end
end
describe
'#check_for_spam?'
do
describe
'#check_for_spam?'
do
...
...
spec/mailers/notify_spec.rb
Просмотр файла @
4a50e1f0
...
@@ -51,7 +51,7 @@
...
@@ -51,7 +51,7 @@
context
'when enabled email_author_in_body'
do
context
'when enabled email_author_in_body'
do
before
do
before
do
allow
(
current_a
pplication
_s
etting
s
).
to
receive
(
:email_author_in_body
).
and_return
(
true
)
allow
_any_instance_of
(
A
pplication
S
etting
).
to
receive
(
:email_author_in_body
).
and_return
(
true
)
end
end
it
'contains a link to note author'
do
it
'contains a link to note author'
do
...
@@ -230,7 +230,7 @@
...
@@ -230,7 +230,7 @@
context
'when enabled email_author_in_body'
do
context
'when enabled email_author_in_body'
do
before
do
before
do
allow
(
current_a
pplication
_s
etting
s
).
to
receive
(
:email_author_in_body
).
and_return
(
true
)
allow
_any_instance_of
(
A
pplication
S
etting
).
to
receive
(
:email_author_in_body
).
and_return
(
true
)
end
end
it
'contains a link to note author'
do
it
'contains a link to note author'
do
...
@@ -454,7 +454,7 @@
...
@@ -454,7 +454,7 @@
context
'when enabled email_author_in_body'
do
context
'when enabled email_author_in_body'
do
before
do
before
do
allow
(
current_a
pplication
_s
etting
s
).
to
receive
(
:email_author_in_body
).
and_return
(
true
)
allow
_any_instance_of
(
A
pplication
S
etting
).
to
receive
(
:email_author_in_body
).
and_return
(
true
)
end
end
it
'contains a link to note author'
do
it
'contains a link to note author'
do
...
...
spec/models/user_spec.rb
Просмотр файла @
4a50e1f0
...
@@ -67,7 +67,7 @@
...
@@ -67,7 +67,7 @@
describe
'email'
do
describe
'email'
do
context
'when no signup domains listed'
do
context
'when no signup domains listed'
do
before
{
allow
(
current_a
pplication
_s
etting
s
).
to
receive
(
:restricted_signup_domains
).
and_return
([])
}
before
{
allow
_any_instance_of
(
A
pplication
S
etting
).
to
receive
(
:restricted_signup_domains
).
and_return
([])
}
it
'accepts any email'
do
it
'accepts any email'
do
user
=
build
(
:user
,
email:
"info@example.com"
)
user
=
build
(
:user
,
email:
"info@example.com"
)
expect
(
user
).
to
be_valid
expect
(
user
).
to
be_valid
...
@@ -75,7 +75,7 @@
...
@@ -75,7 +75,7 @@
end
end
context
'when a signup domain is listed and subdomains are allowed'
do
context
'when a signup domain is listed and subdomains are allowed'
do
before
{
allow
(
current_a
pplication
_s
etting
s
).
to
receive
(
:restricted_signup_domains
).
and_return
([
'example.com'
,
'*.example.com'
])
}
before
{
allow
_any_instance_of
(
A
pplication
S
etting
).
to
receive
(
:restricted_signup_domains
).
and_return
([
'example.com'
,
'*.example.com'
])
}
it
'accepts info@example.com'
do
it
'accepts info@example.com'
do
user
=
build
(
:user
,
email:
"info@example.com"
)
user
=
build
(
:user
,
email:
"info@example.com"
)
expect
(
user
).
to
be_valid
expect
(
user
).
to
be_valid
...
@@ -93,7 +93,7 @@
...
@@ -93,7 +93,7 @@
end
end
context
'when a signup domain is listed and subdomains are not allowed'
do
context
'when a signup domain is listed and subdomains are not allowed'
do
before
{
allow
(
current_a
pplication
_s
etting
s
).
to
receive
(
:restricted_signup_domains
).
and_return
([
'example.com'
])
}
before
{
allow
_any_instance_of
(
A
pplication
S
etting
).
to
receive
(
:restricted_signup_domains
).
and_return
([
'example.com'
])
}
it
'accepts info@example.com'
do
it
'accepts info@example.com'
do
user
=
build
(
:user
,
email:
"info@example.com"
)
user
=
build
(
:user
,
email:
"info@example.com"
)
...
@@ -141,7 +141,7 @@
...
@@ -141,7 +141,7 @@
end
end
describe
'#confirm'
do
describe
'#confirm'
do
before
{
allow
(
current_a
pplication
_s
etting
s
).
to
receive
(
:send_user_confirmation_email
).
and_return
(
true
)
}
before
{
allow
_any_instance_of
(
A
pplication
S
etting
).
to
receive
(
:send_user_confirmation_email
).
and_return
(
true
)
}
let
(
:user
)
{
create
(
:user
,
confirmed_at:
nil
,
unconfirmed_email:
'test@gitlab.com'
)
}
let
(
:user
)
{
create
(
:user
,
confirmed_at:
nil
,
unconfirmed_email:
'test@gitlab.com'
)
}
it
'returns unconfirmed'
do
it
'returns unconfirmed'
do
...
...
spec/services/groups/create_service_spec.rb
Просмотр файла @
4a50e1f0
...
@@ -13,7 +13,7 @@
...
@@ -13,7 +13,7 @@
end
end
context
"cannot create group with restricted visibility level"
do
context
"cannot create group with restricted visibility level"
do
before
{
allow
(
current_a
pplication
_s
etting
s
).
to
receive
(
:restricted_visibility_levels
).
and_return
([
Gitlab
::
VisibilityLevel
::
PUBLIC
])
}
before
{
allow
_any_instance_of
(
A
pplication
S
etting
).
to
receive
(
:restricted_visibility_levels
).
and_return
([
Gitlab
::
VisibilityLevel
::
PUBLIC
])
}
it
{
is_expected
.
not_to
be_persisted
}
it
{
is_expected
.
not_to
be_persisted
}
end
end
end
end
...
...
Редактирование
Предварительный просмотр
Поддерживает Markdown
0%
Попробовать снова
или
прикрепить новый файл
.
Отмена
You are about to add
0
people
to the discussion. Proceed with caution.
Сначала завершите редактирование этого сообщения!
Отмена
Пожалуйста,
зарегистрируйтесь
или
войдите
чтобы прокомментировать