Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
8501e13b
G
gitlab-foss
项目概览
李少辉-开发者
/
gitlab-foss
通知
15
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
gitlab-foss
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
8501e13b
编写于
8月 30, 2019
作者:
J
Juliette de Rancourt
提交者:
Jan Provaznik
8月 30, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Resolve "Use "moved" instead of "closed" in issue references"
上级
770a15b0
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
23 addition
and
2 deletion
+23
-2
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
lib/banzai/filter/issuable_state_filter.rb
lib/banzai/filter/issuable_state_filter.rb
+6
-1
locale/gitlab.pot
locale/gitlab.pot
+3
-0
spec/lib/banzai/filter/issuable_state_filter_spec.rb
spec/lib/banzai/filter/issuable_state_filter_spec.rb
+8
-0
未找到文件。
app/models/issue.rb
浏览文件 @
8501e13b
...
...
@@ -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
浏览文件 @
8501e13b
---
title
:
Use moved instead of closed in issue references
merge_request
:
32277
author
:
juliette-derancourt
type
:
changed
lib/banzai/filter/issuable_state_filter.rb
浏览文件 @
8501e13b
...
...
@@ -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
...
...
locale/gitlab.pot
浏览文件 @
8501e13b
...
...
@@ -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
浏览文件 @
8501e13b
...
...
@@ -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
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录