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
bd87c15d
Commit
bd87c15d
authored
May 25, 2017
by
Oswaldo Ferreira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
User should have write access on source and target issue to create a relation
parent
91a735d4
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
4 deletions
+8
-4
app/services/issue_links/create_service.rb
app/services/issue_links/create_service.rb
+3
-1
spec/services/issue_links/create_service_spec.rb
spec/services/issue_links/create_service_spec.rb
+5
-3
No files found.
app/services/issue_links/create_service.rb
View file @
bd87c15d
...
@@ -44,7 +44,9 @@ module IssueLinks
...
@@ -44,7 +44,9 @@ module IssueLinks
extractor
=
Gitlab
::
ReferenceExtractor
.
new
(
@issue
.
project
,
@current_user
)
extractor
=
Gitlab
::
ReferenceExtractor
.
new
(
@issue
.
project
,
@current_user
)
extractor
.
analyze
(
text
)
extractor
.
analyze
(
text
)
extractor
.
issues
extractor
.
issues
.
select
do
|
issue
|
can?
(
current_user
,
:admin_issue_link
,
issue
.
project
)
end
end
end
end
end
...
...
spec/services/issue_links/create_service_spec.rb
View file @
bd87c15d
...
@@ -40,14 +40,16 @@ describe IssueLinks::CreateService, service: true do
...
@@ -40,14 +40,16 @@ describe IssueLinks::CreateService, service: true do
end
end
end
end
context
'when user has no permission to
reference an
Issue'
do
context
'when user has no permission to
target project
Issue'
do
let
(
:
issue_a
)
{
create
:issue
,
iid:
999
}
let
(
:
target_issue
)
{
create
:issue
}
let
(
:params
)
do
let
(
:params
)
do
{
issue_references:
[
issue_a
.
to_reference
]
}
{
issue_references:
[
target_issue
.
to_reference
(
project
)
]
}
end
end
it
'returns error'
do
it
'returns error'
do
target_issue
.
project
.
add_guest
(
user
)
is_expected
.
to
eq
(
message:
"No Issue found for given reference"
,
status: :error
,
http_status:
401
)
is_expected
.
to
eq
(
message:
"No Issue found for given reference"
,
status: :error
,
http_status:
401
)
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