Skip to content
GitLab
Menu
Why GitLab
Pricing
Contact Sales
Explore
Why GitLab
Pricing
Contact Sales
Explore
Sign in
Get free trial
Primary navigation
Search or go to…
Project
GitLab
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Privacy statement
Keyboard shortcuts
?
What's new
4
Snippets
Groups
Projects
Show more breadcrumbs
GitLab.org
GitLab
Commits
bd87c15d
Commit
bd87c15d
authored
7 years ago
by
Oswaldo Ferreira
Browse files
Options
Downloads
Patches
Plain Diff
User should have write access on source and target issue to create a relation
parent
91a735d4
No related branches found
No related tags found
3 merge requests
!2122
Merge RC2 into 9.3 (actually-stable)
,
!2106
Add RC2 changes to 9-3-stable-ee
,
!1719
Related issues [BE]
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
app/services/issue_links/create_service.rb
+3
-1
3 additions, 1 deletion
app/services/issue_links/create_service.rb
spec/services/issue_links/create_service_spec.rb
+5
-3
5 additions, 3 deletions
spec/services/issue_links/create_service_spec.rb
with
8 additions
and
4 deletions
app/services/issue_links/create_service.rb
+
3
−
1
View file @
bd87c15d
...
...
@@ -44,7 +44,9 @@ def referenced_issues
extractor
=
Gitlab
::
ReferenceExtractor
.
new
(
@issue
.
project
,
@current_user
)
extractor
.
analyze
(
text
)
extractor
.
issues
extractor
.
issues
.
select
do
|
issue
|
can?
(
current_user
,
:admin_issue_link
,
issue
.
project
)
end
end
end
...
...
This diff is collapsed.
Click to expand it.
spec/services/issue_links/create_service_spec.rb
+
5
−
3
View file @
bd87c15d
...
...
@@ -40,14 +40,16 @@
end
end
context
'when user has no permission to
reference an
Issue'
do
let
(
:issue
_a
)
{
create
:issue
,
iid:
999
}
context
'when user has no permission to
target project
Issue'
do
let
(
:
target_
issue
)
{
create
:issue
}
let
(
:params
)
do
{
issue_references:
[
issue
_a
.
to_reference
]
}
{
issue_references:
[
target_
issue
.
to_reference
(
project
)
]
}
end
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
)
end
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment