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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
d69694e8
Commit
d69694e8
authored
Jan 21, 2017
by
Oswaldo Ferreira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplify repo limit convertion from MBs to Bytes
parent
d4bc570e
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
10 additions
and
12 deletions
+10
-12
app/services/application_settings/update_service.rb
app/services/application_settings/update_service.rb
+2
-1
app/services/base_service.rb
app/services/base_service.rb
+0
-7
app/services/groups/create_service.rb
app/services/groups/create_service.rb
+2
-1
app/services/groups/update_service.rb
app/services/groups/update_service.rb
+2
-1
app/services/projects/create_service.rb
app/services/projects/create_service.rb
+2
-1
app/services/projects/update_service.rb
app/services/projects/update_service.rb
+2
-1
No files found.
app/services/application_settings/update_service.rb
View file @
d69694e8
...
...
@@ -2,7 +2,8 @@ module ApplicationSettings
class
UpdateService
<
ApplicationSettings
::
BaseService
def
execute
# Repository size limit comes as MB from the view
assign_repository_size_limit_as_bytes
(
@application_setting
)
limit
=
@params
.
delete
(
:repository_size_limit
)
@application_setting
.
repository_size_limit
=
(
limit
.
to_i
.
megabytes
if
limit
.
present?
)
@application_setting
.
update
(
@params
)
end
...
...
app/services/base_service.rb
View file @
d69694e8
...
...
@@ -46,13 +46,6 @@ class BaseService
private
def
assign_repository_size_limit_as_bytes
(
model
)
repository_size_limit
=
@params
.
delete
(
:repository_size_limit
)
new_value
=
repository_size_limit
.
to_i
.
megabytes
if
repository_size_limit
.
present?
model
.
repository_size_limit
=
new_value
end
def
error
(
message
,
http_status
=
nil
)
result
=
{
message:
message
,
...
...
app/services/groups/create_service.rb
View file @
d69694e8
...
...
@@ -13,7 +13,8 @@ module Groups
end
# Repository size limit comes as MB from the view
assign_repository_size_limit_as_bytes
(
@group
)
limit
=
params
.
delete
(
:repository_size_limit
)
@group
.
repository_size_limit
=
(
limit
.
to_i
.
megabytes
if
limit
.
present?
)
if
@group
.
parent
&&
!
can?
(
current_user
,
:admin_group
,
@group
.
parent
)
@group
.
parent
=
nil
...
...
app/services/groups/update_service.rb
View file @
d69694e8
...
...
@@ -13,7 +13,8 @@ module Groups
end
# Repository size limit comes as MB from the view
assign_repository_size_limit_as_bytes
(
group
)
limit
=
@params
.
delete
(
:repository_size_limit
)
group
.
repository_size_limit
=
(
limit
.
to_i
.
megabytes
if
limit
.
present?
)
group
.
assign_attributes
(
params
)
...
...
app/services/projects/create_service.rb
View file @
d69694e8
...
...
@@ -23,7 +23,8 @@ module Projects
end
# Repository size limit comes as MB from the view
assign_repository_size_limit_as_bytes
(
@project
)
limit
=
params
.
delete
(
:repository_size_limit
)
@project
.
repository_size_limit
=
(
limit
.
to_i
.
megabytes
if
limit
.
present?
)
# Set project name from path
if
@project
.
name
.
present?
&&
@project
.
path
.
present?
...
...
app/services/projects/update_service.rb
View file @
d69694e8
...
...
@@ -14,7 +14,8 @@ module Projects
end
# Repository size limit comes as MB from the view
assign_repository_size_limit_as_bytes
(
project
)
limit
=
params
.
delete
(
:repository_size_limit
)
project
.
repository_size_limit
=
(
limit
.
to_i
.
megabytes
if
limit
.
present?
)
new_branch
=
params
.
delete
(
:default_branch
)
new_repository_storage
=
params
.
delete
(
:repository_storage
)
...
...
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