Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
heptapod
heptapod
Commits
3119fe41feac
Commit
aa933c81
authored
Aug 30, 2019
by
Juliette de Rancourt
Committed by
Jan Provaznik
Aug 30, 2019
Browse files
Resolve "Use "moved" instead of "closed" in issue references"
parent
becf68b36870
Changes
5
Hide whitespace changes
Inline
Side-by-side
app/models/issue.rb
View file @
3119fe41
...
...
@@ -178,7 +178,7 @@ def source_project
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 @
3119fe41
---
title
:
Use moved instead of closed in issue references
merge_request
:
32277
author
:
juliette-derancourt
type
:
changed
lib/banzai/filter/issuable_state_filter.rb
View file @
3119fe41
...
...
@@ -21,7 +21,8 @@ def call
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 @@ def call
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
...
...
locale/gitlab.pot
View file @
3119fe41
...
...
@@ -6191,6 +6191,9 @@ msgstr ""
msgid "IssuableStatus|Closed (%{moved_link_start}moved%{moved_link_end})"
msgstr ""
msgid "IssuableStatus|moved"
msgstr ""
msgid "Issue"
msgstr ""
...
...
spec/lib/banzai/filter/issuable_state_filter_spec.rb
View file @
3119fe41
...
...
@@ -131,6 +131,14 @@ def create_merge_request(state)
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