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
0bb9b964
Commit
0bb9b964
authored
Oct 11, 2016
by
Patricio Cano
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactored tests, better view restrictions, and moved the message generator to a helper.
parent
954b68ed
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
20 additions
and
8 deletions
+20
-8
app/helpers/projects_helper.rb
app/helpers/projects_helper.rb
+4
-0
app/views/projects/_above_size_limit_warning.html.haml
app/views/projects/_above_size_limit_warning.html.haml
+2
-0
app/views/projects/show.html.haml
app/views/projects/show.html.haml
+2
-3
lib/gitlab/repository_size_error.rb
lib/gitlab/repository_size_error.rb
+2
-2
spec/controllers/projects_controller_spec.rb
spec/controllers/projects_controller_spec.rb
+10
-3
No files found.
app/helpers/projects_helper.rb
View file @
0bb9b964
...
...
@@ -220,6 +220,10 @@ module ProjectsHelper
"The total size of this project's repository
#{
show_lfs
}
will be limited to this size. 0 for unlimited. Leave empty to inherit the group/global value."
end
def
project_above_size_limit_message
Gitlab
::
RepositorySizeError
.
new
(
@project
).
above_size_limit_message
end
def
git_user_name
if
current_user
current_user
.
name
...
...
app/views/projects/_
over
_size_limit_warning.html.haml
→
app/views/projects/_
above
_size_limit_warning.html.haml
View file @
0bb9b964
.alert.alert-warning.hidden-xs
=
Gitlab
::
RepositorySizeError
.
new
(
@project
).
over
_size_limit_message
=
project_above
_size_limit_message
app/views/projects/show.html.haml
View file @
0bb9b964
...
...
@@ -8,9 +8,8 @@
-
if
current_user
&&
can?
(
current_user
,
:download_code
,
@project
)
=
render
'shared/no_ssh'
=
render
'shared/no_password'
-
if
@project
.
above_size_limit?
=
render
'over
_size_limit_warning'
=
render
'above
_size_limit_warning'
=
render
'projects/last_push'
=
render
"home_panel"
...
...
lib/gitlab/repository_size_error.rb
View file @
0bb9b964
module
Gitlab
class
RepositorySizeError
<
StandardError
class
RepositorySizeError
include
ActionView
::
Helpers
attr_reader
:project
...
...
@@ -32,7 +32,7 @@ module Gitlab
'Please contact your GitLab administrator for more information.'
end
def
over
_size_limit_message
def
above
_size_limit_message
"
#{
to_s
}
You won't be able to push new code to this project.
#{
more_info_message
}
"
end
...
...
spec/controllers/projects_controller_spec.rb
View file @
0bb9b964
...
...
@@ -92,15 +92,22 @@ describe ProjectsController do
context
'project repo over limit'
do
before
do
sign_in
(
user
)
allow_any_instance_of
(
Project
).
to
receive
(
:above_size_limit?
).
and_return
(
true
)
project
.
team
<<
[
user
,
:master
]
end
it
'shows the over size limit warning message'
do
it
'shows the over size limit warning message for project members'
do
allow
(
controller
).
to
receive
(
:current_user
).
and_return
(
user
)
get
:show
,
namespace_id:
project
.
namespace
.
path
,
id:
project
.
path
expect
(
response
).
to
render_template
(
'_above_size_limit_warning'
)
end
it
'does not show the message for non members'
do
get
:show
,
namespace_id:
project
.
namespace
.
path
,
id:
project
.
path
expect
(
response
).
to
render_template
(
'_over
_size_limit_warning'
)
expect
(
response
).
not_to
render_template
(
'_above
_size_limit_warning'
)
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