Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
61f5c2e3
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,发现更多精彩内容 >>
提交
61f5c2e3
编写于
8月 02, 2018
作者:
S
Stan Hu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add a comment when user can't be identified
上级
f2a99398
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
20 addition
and
6 deletion
+20
-6
lib/gitlab/bitbucket_server_import/importer.rb
lib/gitlab/bitbucket_server_import/importer.rb
+10
-2
spec/lib/gitlab/bitbucket_server_import/importer_spec.rb
spec/lib/gitlab/bitbucket_server_import/importer_spec.rb
+10
-4
未找到文件。
lib/gitlab/bitbucket_server_import/importer.rb
浏览文件 @
61f5c2e3
...
...
@@ -298,7 +298,15 @@ module Gitlab
end
def
pull_request_comment_attributes
(
comment
)
note
=
author
=
find_user_id
(
comment
.
author_email
)
note
=
''
unless
author
author
=
project
.
creator_id
note
=
"*By
#{
comment
.
author_username
}
(
#{
comment
.
author_email
}
) on
#{
comment
.
created_at
}
*
\n\n
"
end
note
+=
# Provide some context for replying
if
comment
.
parent_comment
">
#{
comment
.
parent_comment
.
note
.
truncate
(
80
)
}
\n\n
#{
comment
.
note
}
"
...
...
@@ -309,7 +317,7 @@ module Gitlab
{
project:
project
,
note:
note
,
author_id:
gitlab_user_id
(
comment
.
author_email
)
,
author_id:
author
,
created_at:
comment
.
created_at
,
updated_at:
comment
.
updated_at
}
...
...
spec/lib/gitlab/bitbucket_server_import/importer_spec.rb
浏览文件 @
61f5c2e3
...
...
@@ -73,6 +73,7 @@ describe Gitlab::BitbucketServerImport::Importer do
BitbucketServer
::
Representation
::
Comment
,
note:
'Hello world'
,
author_email:
'unknown@gmail.com'
,
author_username:
'The Flash'
,
comments:
[],
created_at:
now
,
updated_at:
now
,
...
...
@@ -105,7 +106,7 @@ describe Gitlab::BitbucketServerImport::Importer do
merge_request
=
MergeRequest
.
first
expect
(
merge_request
.
notes
.
count
).
to
eq
(
1
)
note
=
merge_request
.
notes
.
first
expect
(
note
.
note
).
to
e
q
(
@pr_note
.
note
)
expect
(
note
.
note
).
to
e
nd_with
(
@pr_note
.
note
)
expect
(
note
.
author
).
to
eq
(
project
.
owner
)
expect
(
note
.
created_at
).
to
eq
(
@pr_note
.
created_at
)
expect
(
note
.
updated_at
).
to
eq
(
@pr_note
.
created_at
)
...
...
@@ -115,6 +116,7 @@ describe Gitlab::BitbucketServerImport::Importer do
reply
=
instance_double
(
BitbucketServer
::
Representation
::
PullRequestComment
,
author_email:
'someuser@gitlab.com'
,
author_username:
'Batman'
,
note:
'I agree'
,
created_at:
now
,
updated_at:
now
)
...
...
@@ -130,6 +132,7 @@ describe Gitlab::BitbucketServerImport::Importer do
new_pos:
4
,
note:
'Hello world'
,
author_email:
'unknown@gmail.com'
,
author_username:
'Superman'
,
comments:
[
reply
],
created_at:
now
,
updated_at:
now
,
...
...
@@ -155,7 +158,7 @@ describe Gitlab::BitbucketServerImport::Importer do
notes
=
merge_request
.
notes
.
order
(
:id
).
to_a
start_note
=
notes
.
first
expect
(
start_note
.
type
).
to
eq
(
'DiffNote'
)
expect
(
start_note
.
note
).
to
e
q
(
inline_note
.
note
)
expect
(
start_note
.
note
).
to
e
nd_with
(
inline_note
.
note
)
expect
(
start_note
.
created_at
).
to
eq
(
inline_note
.
created_at
)
expect
(
start_note
.
updated_at
).
to
eq
(
inline_note
.
updated_at
)
expect
(
start_note
.
position
.
base_sha
).
to
eq
(
inline_note
.
from_sha
)
...
...
@@ -165,8 +168,9 @@ describe Gitlab::BitbucketServerImport::Importer do
expect
(
start_note
.
position
.
new_line
).
to
eq
(
inline_note
.
new_pos
)
reply_note
=
notes
.
last
# Make sure reply context is included
expect
(
reply_note
.
note
).
to
eq
(
">
#{
inline_note
.
note
}
\n\n
#{
reply
.
note
}
"
)
# Make sure author and reply context is included
expect
(
reply_note
.
note
).
to
start_with
(
"*By
#{
reply
.
author_username
}
(
#{
reply
.
author_email
}
) on
#{
reply
.
created_at
}
*
\n\n
"
)
expect
(
reply_note
.
note
).
to
end_with
(
">
#{
inline_note
.
note
}
\n\n
#{
reply
.
note
}
"
)
expect
(
reply_note
.
author
).
to
eq
(
project
.
owner
)
expect
(
reply_note
.
created_at
).
to
eq
(
reply
.
created_at
)
expect
(
reply_note
.
updated_at
).
to
eq
(
reply
.
created_at
)
...
...
@@ -181,6 +185,7 @@ describe Gitlab::BitbucketServerImport::Importer do
reply
=
instance_double
(
BitbucketServer
::
Representation
::
Comment
,
author_email:
'someuser@gitlab.com'
,
author_username:
'Aquaman'
,
note:
'I agree'
,
created_at:
now
,
updated_at:
now
)
...
...
@@ -196,6 +201,7 @@ describe Gitlab::BitbucketServerImport::Importer do
new_pos:
9
,
note:
'This is a note with an invalid line position.'
,
author_email:
project
.
owner
.
email
,
author_username:
'Owner'
,
comments:
[
reply
],
created_at:
now
,
updated_at:
now
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录