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
83511120
Commit
83511120
authored
Mar 16, 2022
by
Gary Holtz
Committed by
Andrew Fontaine
Mar 28, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Using an existing function for commit list check
parent
5f4c1308
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
3 additions
and
28 deletions
+3
-28
app/helpers/projects_helper.rb
app/helpers/projects_helper.rb
+0
-4
app/views/shared/projects/_list.html.haml
app/views/shared/projects/_list.html.haml
+2
-2
spec/helpers/projects_helper_spec.rb
spec/helpers/projects_helper_spec.rb
+0
-21
spec/views/shared/projects/_list.html.haml_spec.rb
spec/views/shared/projects/_list.html.haml_spec.rb
+1
-1
No files found.
app/helpers/projects_helper.rb
View file @
83511120
...
@@ -428,10 +428,6 @@ module ProjectsHelper
...
@@ -428,10 +428,6 @@ module ProjectsHelper
project
.
merge_requests_enabled?
&&
can?
(
user
,
:read_merge_request
,
project
)
project
.
merge_requests_enabled?
&&
can?
(
user
,
:read_merge_request
,
project
)
end
end
def
able_to_see_last_commit?
(
show_last_commit_as_description
,
project
,
user
)
show_last_commit_as_description
&&
can?
(
user
,
:read_commit_status
,
project
)
end
def
fork_button_disabled_tooltip
(
project
)
def
fork_button_disabled_tooltip
(
project
)
return
unless
current_user
return
unless
current_user
...
...
app/views/shared/projects/_list.html.haml
View file @
83511120
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
-
pipeline_status
=
true
unless
local_assigns
[
:pipeline_status
]
==
false
-
pipeline_status
=
true
unless
local_assigns
[
:pipeline_status
]
==
false
-
skip_namespace
=
false
unless
local_assigns
[
:skip_namespace
]
==
true
-
skip_namespace
=
false
unless
local_assigns
[
:skip_namespace
]
==
true
-
user
=
local_assigns
[
:user
]
-
user
=
local_assigns
[
:user
]
-
show_last_commit_as_description
=
false
unless
local_assigns
[
:show_last_commit_as_description
]
==
true
-
show_last_commit_as_description
=
false
unless
local_assigns
[
:show_last_commit_as_description
]
==
true
&&
can_show_last_commit_in_list?
(
project
)
-
remote
=
false
unless
local_assigns
[
:remote
]
==
true
-
remote
=
false
unless
local_assigns
[
:remote
]
==
true
-
skip_pagination
=
false
unless
local_assigns
[
:skip_pagination
]
==
true
-
skip_pagination
=
false
unless
local_assigns
[
:skip_pagination
]
==
true
-
compact_mode
=
false
unless
local_assigns
[
:compact_mode
]
==
true
-
compact_mode
=
false
unless
local_assigns
[
:compact_mode
]
==
true
...
@@ -37,7 +37,7 @@
...
@@ -37,7 +37,7 @@
-
css_class
=
(
i
>=
projects_limit
)
||
project
.
pending_delete?
?
'hide'
:
nil
-
css_class
=
(
i
>=
projects_limit
)
||
project
.
pending_delete?
?
'hide'
:
nil
=
render
"shared/projects/project"
,
project:
project
,
skip_namespace:
skip_namespace
,
=
render
"shared/projects/project"
,
project:
project
,
skip_namespace:
skip_namespace
,
avatar:
avatar
,
stars:
stars
,
css_class:
css_class
,
use_creator_avatar:
use_creator_avatar
,
avatar:
avatar
,
stars:
stars
,
css_class:
css_class
,
use_creator_avatar:
use_creator_avatar
,
forks:
project
.
forking_enabled?
,
show_last_commit_as_description:
able_to_see_last_commit?
(
show_last_commit_as_description
,
project
,
user
)
,
forks:
project
.
forking_enabled?
,
show_last_commit_as_description:
show_last_commit_as_description
,
user:
user
,
merge_requests:
able_to_see_merge_requests?
(
project
,
user
),
issues:
able_to_see_issues?
(
project
,
user
),
user:
user
,
merge_requests:
able_to_see_merge_requests?
(
project
,
user
),
issues:
able_to_see_issues?
(
project
,
user
),
pipeline_status:
pipeline_status
,
compact_mode:
compact_mode
pipeline_status:
pipeline_status
,
compact_mode:
compact_mode
=
paginate_collection
(
projects
,
remote:
remote
)
unless
skip_pagination
=
paginate_collection
(
projects
,
remote:
remote
)
unless
skip_pagination
...
...
spec/helpers/projects_helper_spec.rb
View file @
83511120
...
@@ -1046,27 +1046,6 @@ RSpec.describe ProjectsHelper do
...
@@ -1046,27 +1046,6 @@ RSpec.describe ProjectsHelper do
end
end
end
end
end
end
describe
"#able_to_see_last_commit?"
do
subject
{
helper
.
able_to_see_last_commit?
(
show_last_commit_as_description
,
project
,
user
)
}
where
(
:can_read_last_commit
,
:show_last_commit_as_description
,
:expected
)
do
false
|
false
|
false
true
|
false
|
false
false
|
true
|
false
true
|
true
|
true
end
with_them
do
before
do
allow
(
helper
).
to
receive
(
:can?
).
with
(
user
,
:read_commit_status
,
project
).
and_return
(
can_read_last_commit
)
end
it
'returns the correct response'
do
expect
(
subject
).
to
eq
(
expected
)
end
end
end
end
end
describe
'#fork_button_disabled_tooltip'
do
describe
'#fork_button_disabled_tooltip'
do
...
...
spec/views/shared/projects/_list.html.haml_spec.rb
View file @
83511120
...
@@ -22,7 +22,7 @@ RSpec.describe 'shared/projects/_list' do
...
@@ -22,7 +22,7 @@ RSpec.describe 'shared/projects/_list' do
end
end
it
"will not show elements a user shouldn't be able to see"
do
it
"will not show elements a user shouldn't be able to see"
do
allow
(
view
).
to
receive
(
:
able_to_see_last_commi
t?
).
and_return
(
false
)
allow
(
view
).
to
receive
(
:
can_show_last_commit_in_lis
t?
).
and_return
(
false
)
allow
(
view
).
to
receive
(
:able_to_see_merge_requests?
).
and_return
(
false
)
allow
(
view
).
to
receive
(
:able_to_see_merge_requests?
).
and_return
(
false
)
allow
(
view
).
to
receive
(
:able_to_see_issues?
).
and_return
(
false
)
allow
(
view
).
to
receive
(
:able_to_see_issues?
).
and_return
(
false
)
...
...
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