Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
1817f877
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,发现更多精彩内容 >>
提交
1817f877
编写于
4月 08, 2017
作者:
D
Douwe Maan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Some code tweaks
上级
a8339fe1
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
21 addition
and
18 deletion
+21
-18
app/controllers/projects/merge_requests_controller.rb
app/controllers/projects/merge_requests_controller.rb
+3
-6
app/helpers/notes_helper.rb
app/helpers/notes_helper.rb
+1
-1
app/models/concerns/discussion_on_diff.rb
app/models/concerns/discussion_on_diff.rb
+0
-8
app/models/concerns/note_on_diff.rb
app/models/concerns/note_on_diff.rb
+4
-0
app/models/legacy_diff_discussion.rb
app/models/legacy_diff_discussion.rb
+8
-0
app/views/discussions/_discussion.html.haml
app/views/discussions/_discussion.html.haml
+1
-0
app/views/projects/merge_requests/show/_versions.html.haml
app/views/projects/merge_requests/show/_versions.html.haml
+3
-2
spec/features/merge_requests/merge_request_versions_spec.rb
spec/features/merge_requests/merge_request_versions_spec.rb
+1
-1
未找到文件。
app/controllers/projects/merge_requests_controller.rb
浏览文件 @
1817f877
...
...
@@ -576,13 +576,10 @@ class Projects::MergeRequestsController < Projects::ApplicationController
@comparable_diffs
=
@merge_request_diffs
.
select
{
|
diff
|
diff
.
id
<
@merge_request_diff
.
id
}
if
params
[
:start_sha
].
present?
@
start_sha
=
params
[
:start_sha
]
@start_version
=
@comparable_diffs
.
find
{
|
diff
|
diff
.
head_commit_sha
==
@
start_sha
}
start_sha
=
params
[
:start_sha
]
@start_version
=
@comparable_diffs
.
find
{
|
diff
|
diff
.
head_commit_sha
==
start_sha
}
unless
@start_version
@start_sha
=
@merge_request_diff
.
head_commit_sha
@start_version
=
@merge_request_diff
end
@start_sha
=
start_sha
if
@start_version
end
@diffs
=
...
...
app/helpers/notes_helper.rb
浏览文件 @
1817f877
...
...
@@ -76,7 +76,7 @@ module NotesHelper
diffs_namespace_project_merge_request_path
(
discussion
.
project
.
namespace
,
discussion
.
project
,
discussion
.
noteable
,
diff_id:
diff_id
,
anchor:
discussion
.
line_code
)
elsif
discussion
.
for_commit?
anchor
=
discussion
.
line_code
if
discussion
.
diff_discussion?
namespace_project_commit_path
(
discussion
.
project
.
namespace
,
discussion
.
project
,
discussion
.
noteable
,
anchor:
anchor
)
end
end
...
...
app/models/concerns/discussion_on_diff.rb
浏览文件 @
1817f877
...
...
@@ -5,8 +5,6 @@ module DiscussionOnDiff
included
do
NUMBER_OF_TRUNCATED_DIFF_LINES
=
16
memoized_values
<<
:active
delegate
:line_code
,
:original_line_code
,
:diff_file
,
...
...
@@ -29,12 +27,6 @@ module DiscussionOnDiff
true
end
def
active?
return
@active
if
@active
.
present?
@active
=
first_note
.
active?
end
# Returns an array of at most 16 highlighted lines above a diff note
def
truncated_diff_lines
(
highlight:
true
)
lines
=
highlight
?
highlighted_diff_lines
:
diff_lines
...
...
app/models/concerns/note_on_diff.rb
浏览文件 @
1817f877
...
...
@@ -26,6 +26,10 @@ module NoteOnDiff
raise
NotImplementedError
end
def
active?
(
diff_refs
=
nil
)
raise
NotImplementedError
end
private
def
noteable_diff_refs
...
...
app/models/legacy_diff_discussion.rb
浏览文件 @
1817f877
...
...
@@ -7,6 +7,8 @@
class
LegacyDiffDiscussion
<
Discussion
include
DiscussionOnDiff
memoized_values
<<
:active
def
legacy_diff_discussion?
true
end
...
...
@@ -15,6 +17,12 @@ class LegacyDiffDiscussion < Discussion
LegacyDiffNote
end
def
active?
(
*
args
)
return
@active
if
@active
.
present?
@active
=
first_note
.
active?
(
*
args
)
end
def
collapsed?
!
active?
end
...
...
app/views/discussions/_discussion.html.haml
浏览文件 @
1817f877
...
...
@@ -30,6 +30,7 @@
-
else
a deleted commit
-
elsif
discussion
.
diff_discussion?
on
=
conditional_link_to
url
.
present?
,
url
do
-
if
discussion
.
active?
the diff
...
...
app/views/projects/merge_requests/show/_versions.html.haml
浏览文件 @
1817f877
...
...
@@ -72,13 +72,14 @@
=
link_to
namespace_project_compare_path
(
@project
.
namespace
,
@project
,
from:
@start_version
.
base_commit_sha
,
to:
@merge_request_diff
.
base_commit_sha
)
do
new commits
from
%code
=
@merge_request
.
target_branch
=
succeed
'.'
do
%code
=
@merge_request
.
target_branch
-
if
@diff_notes_disabled
.comments-disabled-notif.content-block
=
icon
(
'info-circle'
)
-
if
@start_sha
Comment
creation is
disabled because you're comparing two versions of this merge request.
Comment
s are
disabled because you're comparing two versions of this merge request.
-
else
Discussions on this old version of the merge request are displayed but comment creation is disabled.
...
...
spec/features/merge_requests/merge_request_versions_spec.rb
浏览文件 @
1817f877
...
...
@@ -66,7 +66,7 @@ feature 'Merge Request versions', js: true, feature: true do
end
it
'show the message about disabled comments'
do
expect
(
page
).
to
have_content
'Comment
creation is
disabled'
expect
(
page
).
to
have_content
'Comment
s are
disabled'
end
it
'show diff between new and old version'
do
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录