BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
962f9efe
Commit
962f9efe
authored
Feb 21, 2017
by
Lin Jen-Shin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update error message and check with presence: true
Feedback:
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/9219#note_23762243
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/9219#note_23762268
parent
a538b0da
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
6 deletions
+11
-6
application_setting.rb
app/models/application_setting.rb
+11
-6
No files found.
app/models/application_setting.rb
View file @
962f9efe
...
@@ -80,6 +80,7 @@ class ApplicationSetting < ActiveRecord::Base
...
@@ -80,6 +80,7 @@ class ApplicationSetting < ActiveRecord::Base
presence:
true
,
presence:
true
,
numericality:
{
only_integer:
true
,
greater_than:
0
}
numericality:
{
only_integer:
true
,
greater_than:
0
}
validates
:default_artifacts_expire_in
,
presence:
true
validate
:check_default_artifacts_expire_in
validate
:check_default_artifacts_expire_in
validates
:container_registry_token_expire_delay
,
validates
:container_registry_token_expire_delay
,
...
@@ -222,6 +223,14 @@ class ApplicationSetting < ActiveRecord::Base
...
@@ -222,6 +223,14 @@ class ApplicationSetting < ActiveRecord::Base
create
(
defaults
)
create
(
defaults
)
end
end
def
self
.
human_attribute_name
(
attr
,
_options
=
{})
if
attr
==
:default_artifacts_expire_in
'Default artifacts expiration'
else
super
end
end
def
home_page_url_column_exist
def
home_page_url_column_exist
ActiveRecord
::
Base
.
connection
.
column_exists?
(
:application_settings
,
:home_page_url
)
ActiveRecord
::
Base
.
connection
.
column_exists?
(
:application_settings
,
:home_page_url
)
end
end
...
@@ -298,12 +307,8 @@ class ApplicationSetting < ActiveRecord::Base
...
@@ -298,12 +307,8 @@ class ApplicationSetting < ActiveRecord::Base
end
end
def
check_default_artifacts_expire_in
def
check_default_artifacts_expire_in
if
default_artifacts_expire_in
.
blank?
ChronicDuration
.
parse
(
default_artifacts_expire_in
)
errors
.
add
(
:default_artifacts_expiration
,
"is not presented"
)
else
ChronicDuration
.
parse
(
default_artifacts_expire_in
)
end
rescue
ChronicDuration
::
DurationParseError
rescue
ChronicDuration
::
DurationParseError
errors
.
add
(
:default_artifacts_expiration
,
"is
invalid
"
)
errors
.
add
(
:default_artifacts_expiration
,
"is
not a correct duration
"
)
end
end
end
end
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