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
c1df6a44
Commit
c1df6a44
authored
May 25, 2017
by
Oswaldo Ferreira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Memoize "destroy issue link on current project" permission
parent
7678e702
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
6 deletions
+10
-6
app/services/issue_links/list_service.rb
app/services/issue_links/list_service.rb
+9
-5
spec/services/issue_links/list_service_spec.rb
spec/services/issue_links/list_service_spec.rb
+1
-1
No files found.
app/services/issue_links/list_service.rb
View file @
c1df6a44
...
...
@@ -45,12 +45,16 @@ module IssueLinks
end
def
destroy_relation_path
(
issue
)
return
unless
can_destroy_issue_link?
(
@project
)
&&
can_destroy_issue_link?
(
issue
.
project
)
if
can_destroy_issue_link_on_current_project?
&&
can_destroy_issue_link?
(
issue
.
project
)
namespace_project_issue_link_path
(
issue
.
project
.
namespace
,
issue
.
project
,
issue
.
iid
,
issue
.
issue_links_id
)
end
end
namespace_project_issue_link_path
(
issue
.
project
.
namespace
,
issue
.
project
,
issue
.
iid
,
issue
.
issue_links_id
)
def
can_destroy_issue_link_on_current_project?
@can_destroy_on_current_project
||=
can_destroy_issue_link?
(
@project
)
end
def
can_destroy_issue_link?
(
project
)
...
...
spec/services/issue_links/list_service_spec.rb
View file @
c1df6a44
...
...
@@ -35,7 +35,7 @@ describe IssueLinks::ListService, service: true do
it
'verifies number of queries'
do
recorded
=
ActiveRecord
::
QueryRecorder
.
new
{
subject
}
expect
(
recorded
.
count
).
to
be_within
(
1
).
of
(
39
)
expect
(
recorded
.
count
).
to
be_within
(
1
).
of
(
42
)
end
it
'returns related issues JSON'
do
...
...
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