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
160023d5
Commit
160023d5
authored
Aug 30, 2019
by
GitLab Bot
Browse files
Options
Browse Files
Download
Plain Diff
Automatic merge of gitlab-org/gitlab-ce master
parents
8bc204fb
4bcb71b1
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
28 additions
and
7 deletions
+28
-7
app/models/issue.rb
app/models/issue.rb
+1
-1
changelogs/unreleased/66264-moved-issue-reference.yml
changelogs/unreleased/66264-moved-issue-reference.yml
+5
-0
doc/api/deploy_keys.md
doc/api/deploy_keys.md
+8
-5
lib/banzai/filter/issuable_state_filter.rb
lib/banzai/filter/issuable_state_filter.rb
+6
-1
spec/lib/banzai/filter/issuable_state_filter_spec.rb
spec/lib/banzai/filter/issuable_state_filter_spec.rb
+8
-0
No files found.
app/models/issue.rb
View file @
160023d5
...
...
@@ -178,7 +178,7 @@ class Issue < ApplicationRecord
end
def
moved?
!
moved_to
.
nil?
!
moved_to
_id
.
nil?
end
def
can_move?
(
user
,
to_project
=
nil
)
...
...
changelogs/unreleased/66264-moved-issue-reference.yml
0 → 100644
View file @
160023d5
---
title
:
Use moved instead of closed in issue references
merge_request
:
32277
author
:
juliette-derancourt
type
:
changed
doc/api/deploy_keys.md
View file @
160023d5
...
...
@@ -212,22 +212,25 @@ group, this can be achieved quite easily with the API.
First, find the ID of the projects you're interested in, by either listing all
projects:
```
```
bash
curl
--header
'PRIVATE-TOKEN: <your_access_token>'
https://gitlab.example.com/api/v4/projects
```
Or finding the ID of a group
and then listing all projects in that group
:
Or finding the ID of a group:
```
```
bash
curl
--header
'PRIVATE-TOKEN: <your_access_token>'
https://gitlab.example.com/api/v4/groups
```
# For group 1234:
Then listing all projects in that group (for example, group 1234):
```
bash
curl
--header
'PRIVATE-TOKEN: <your_access_token>'
https://gitlab.example.com/api/v4/groups/1234
```
With those IDs, add the same deploy key to all:
```
```
bash
for
project_id
in
321 456 987
;
do
curl
--request
POST
--header
"PRIVATE-TOKEN: <your_access_token>"
--header
"Content-Type: application/json"
\
--data
'{"title": "my key", "key": "ssh-rsa AAAA..."}'
https://gitlab.example.com/api/v4/projects/
${
project_id
}
/deploy_keys
...
...
lib/banzai/filter/issuable_state_filter.rb
View file @
160023d5
...
...
@@ -21,7 +21,8 @@ module Banzai
next
if
!
can_read_cross_project?
&&
cross_reference?
(
issuable
)
if
VISIBLE_STATES
.
include?
(
issuable
.
state
)
&&
issuable_reference?
(
node
.
inner_html
,
issuable
)
node
.
content
+=
" (
#{
issuable
.
state
}
)"
state
=
moved_issue?
(
issuable
)
?
s_
(
"IssuableStatus|moved"
)
:
issuable
.
state
node
.
content
+=
" (
#{
state
}
)"
end
end
...
...
@@ -30,6 +31,10 @@ module Banzai
private
def
moved_issue?
(
issuable
)
issuable
.
instance_of?
(
Issue
)
&&
issuable
.
moved?
end
def
issuable_reference?
(
text
,
issuable
)
CGI
.
unescapeHTML
(
text
)
==
issuable
.
reference_link_text
(
project
||
group
)
end
...
...
spec/lib/banzai/filter/issuable_state_filter_spec.rb
View file @
160023d5
...
...
@@ -131,6 +131,14 @@ describe Banzai::Filter::IssuableStateFilter do
expect
(
doc
.
css
(
'a'
).
last
.
text
).
to
eq
(
"
#{
closed_issue
.
to_reference
}
(closed)"
)
end
it
'appends state to moved issue references'
do
moved_issue
=
create
(
:issue
,
:closed
,
project:
project
,
moved_to:
create_issue
(
:opened
))
link
=
create_link
(
moved_issue
.
to_reference
,
issue:
moved_issue
.
id
,
reference_type:
'issue'
)
doc
=
filter
(
link
,
context
)
expect
(
doc
.
css
(
'a'
).
last
.
text
).
to
eq
(
"
#{
moved_issue
.
to_reference
}
(moved)"
)
end
end
context
'for merge request references'
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