Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
ed94cde2
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,发现更多精彩内容 >>
提交
ed94cde2
编写于
4月 15, 2015
作者:
M
Marin Jankovski
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #9089 from dsander/fix-merge-request-comments
Fix merge request comments on files with multiple commits
上级
fb7ce7bd
d4fec49a
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
11 addition
and
7 deletion
+11
-7
CHANGELOG
CHANGELOG
+1
-0
app/helpers/diff_helper.rb
app/helpers/diff_helper.rb
+1
-1
app/models/note.rb
app/models/note.rb
+5
-1
app/views/projects/diffs/_text_file.html.haml
app/views/projects/diffs/_text_file.html.haml
+1
-1
app/views/projects/notes/_discussion.html.haml
app/views/projects/notes/_discussion.html.haml
+3
-4
未找到文件。
CHANGELOG
浏览文件 @
ed94cde2
...
...
@@ -88,6 +88,7 @@ v 7.10.0 (unreleased)
- Allow user to choose a public email to show on public profile
- Remove truncation from issue titles on milestone page (Jason Blanchard)
- Fix stuck Merge Request merging events from old installations (Ben Bodenmiller)
- Fix merge request comments on files with multiple commits
v 7.9.3
- Contains no changes
...
...
app/helpers/diff_helper.rb
浏览文件 @
ed94cde2
...
...
@@ -101,7 +101,7 @@ module DiffHelper
end
def
line_comments
@line_comments
||=
@line_notes
.
group_by
(
&
:line_code
)
@line_comments
||=
@line_notes
.
select
(
&
:active?
).
group_by
(
&
:line_code
)
end
def
organize_comments
(
type_left
,
type_right
,
line_code_left
,
line_code_right
)
...
...
app/models/note.rb
浏览文件 @
ed94cde2
...
...
@@ -354,7 +354,7 @@ class Note < ActiveRecord::Base
def
set_diff
# First lets find notes with same diff
# before iterating over all mr diffs
diff
=
Note
.
where
(
noteable_id:
self
.
noteable_id
,
noteable_type:
self
.
noteable_type
,
line_code:
self
.
line_code
).
last
.
try
(
:diff
)
diff
=
diff_for_line_code
unless
for_merge_request?
diff
||=
find_diff
self
.
st_diff
=
diff
.
to_hash
if
diff
...
...
@@ -364,6 +364,10 @@ class Note < ActiveRecord::Base
@diff
||=
Gitlab
::
Git
::
Diff
.
new
(
st_diff
)
if
st_diff
.
respond_to?
(
:map
)
end
def
diff_for_line_code
Note
.
where
(
noteable_id:
noteable_id
,
noteable_type:
noteable_type
,
line_code:
line_code
).
last
.
try
(
:diff
)
end
# Check if such line of code exists in merge request diff
# If exists - its active discussion
# If not - its outdated diff
...
...
app/views/projects/diffs/_text_file.html.haml
浏览文件 @
ed94cde2
...
...
@@ -23,7 +23,7 @@
%td
.line_content
{
class:
"noteable_line #{type} #{line_code}"
,
"line_code"
=>
line_code
}=
raw
diff_line_content
(
line
.
text
)
-
if
@reply_allowed
-
comments
=
@line_notes
.
select
{
|
n
|
n
.
line_code
==
line_code
}.
sort_by
(
&
:created_at
)
-
comments
=
@line_notes
.
select
{
|
n
|
n
.
line_code
==
line_code
&&
n
.
active?
}.
sort_by
(
&
:created_at
)
-
unless
comments
.
empty?
=
render
"projects/notes/diff_notes_with_reply"
,
notes:
comments
,
line:
line
.
text
...
...
app/views/projects/notes/_discussion.html.haml
浏览文件 @
ed94cde2
...
...
@@ -6,9 +6,8 @@
=
image_tag
avatar_icon
(
note
.
author_email
),
class:
"avatar s40"
.timeline-content
-
if
note
.
for_merge_request?
-
if
note
.
outdated?
=
render
"projects/notes/discussions/outdated"
,
discussion_notes:
discussion_notes
-
else
=
render
"projects/notes/discussions/active"
,
discussion_notes:
discussion_notes
-
(
active_notes
,
outdated_notes
)
=
discussion_notes
.
partition
(
&
:active?
)
=
render
"projects/notes/discussions/active"
,
discussion_notes:
active_notes
if
active_notes
.
length
>
0
=
render
"projects/notes/discussions/outdated"
,
discussion_notes:
outdated_notes
if
outdated_notes
.
length
>
0
-
else
=
render
"projects/notes/discussions/commit"
,
discussion_notes:
discussion_notes
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录