Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
5e860656
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,体验更适合开发者的 AI 搜索 >>
提交
5e860656
编写于
7月 26, 2016
作者:
P
Phil Hughes
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Added ability to toggle resolving by commenting
上级
6537a4a8
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
41 addition
and
16 deletion
+41
-16
app/assets/javascripts/diff_notes/components/resolve_all_btn.js.es6
.../javascripts/diff_notes/components/resolve_all_btn.js.es6
+1
-9
app/assets/javascripts/diff_notes/services/resolve.js.es6
app/assets/javascripts/diff_notes/services/resolve.js.es6
+19
-0
app/assets/javascripts/diff_notes/stores/comments.js.es6
app/assets/javascripts/diff_notes/stores/comments.js.es6
+11
-2
app/assets/javascripts/notes.js
app/assets/javascripts/notes.js
+8
-4
app/views/projects/merge_requests/_discussion.html.haml
app/views/projects/merge_requests/_discussion.html.haml
+1
-1
app/views/projects/notes/_form.html.haml
app/views/projects/notes/_form.html.haml
+1
-0
未找到文件。
app/assets/javascripts/diff_notes/components/resolve_all_btn.js.es6
浏览文件 @
5e860656
...
...
@@ -40,15 +40,7 @@
},
methods: {
resolve: function () {
let promise;
if (this.allResolved) {
promise = ResolveService
.unResolveAll(this.namespace, this.mergeRequestId, this.discussionId);
} else {
promise = ResolveService
.resolveAll(this.namespace, this.mergeRequestId, this.discussionId);
}
ResolveService.toggleResolveForDiscussion(this.namespace, this.mergeRequestId, this.discussionId);
}
}
});
...
...
app/assets/javascripts/diff_notes/services/resolve.js.es6
浏览文件 @
5e860656
...
...
@@ -23,6 +23,25 @@
return this.noteResource.delete({ noteId }, {});
}
toggleResolveForDiscussion(namespace, mergeRequestId, discussionId) {
const noteIds = CommentsStore.notesForDiscussion(discussionId);
let isResolved = true;
for (const noteId of noteIds) {
const resolved = CommentsStore.state[discussionId][noteId];
if (!resolved) {
isResolved = false;
}
}
if (isResolved) {
return this.unResolveAll(namespace, mergeRequestId, discussionId);
} else {
return this.resolveAll(namespace, mergeRequestId, discussionId);
}
}
resolveAll(namespace, mergeRequestId, discussionId) {
this.setCSRF();
Vue.http.options.root = `/${namespace}`;
...
...
app/assets/javascripts/diff_notes/stores/comments.js.es6
浏览文件 @
5e860656
...
...
@@ -25,13 +25,22 @@
}
},
updateCommentsForDiscussion: function (discussionId, resolve) {
const noteIds = CommentsStore.
n
otesForDiscussion(discussionId, resolve);
const noteIds = CommentsStore.
resolvedN
otesForDiscussion(discussionId, resolve);
for (const noteId of noteIds) {
CommentsStore.update(discussionId, noteId, resolve);
}
},
notesForDiscussion: function (discussionId, resolve) {
notesForDiscussion: function (discussionId) {
let ids = [];
for (const noteId in CommentsStore.state[discussionId]) {
ids.push(noteId);
}
return ids;
},
resolvedNotesForDiscussion: function (discussionId, resolve) {
let ids = [];
for (const noteId in CommentsStore.state[discussionId]) {
...
...
app/assets/javascripts/notes.js
浏览文件 @
5e860656
...
...
@@ -401,11 +401,14 @@
this
.
removeDiscussionNoteForm
(
$form
);
if
(
$form
.
attr
(
'
data-resolve-all
'
)
!=
null
)
{
var
namespace
=
$form
.
attr
(
'
data-namespace
'
),
discussionId
=
$form
.
attr
(
'
data-discussion-id
'
);
var
namespacePath
=
$form
.
attr
(
'
data-namespace-path
'
),
projectPath
=
$form
.
attr
(
'
data-project-path
'
)
discussionId
=
$form
.
attr
(
'
data-discussion-id
'
),
mergeRequestId
=
$
(
'
input[name="noteable_iid"]
'
,
$form
).
val
(),
namespace
=
`
${
namespacePath
}
/
${
projectPath
}
`
;
if
(
ResolveService
!=
null
)
{
ResolveService
.
resolveAll
(
namespace
,
discussionId
,
false
)
ResolveService
.
toggleResolveForDiscussion
(
namespace
,
mergeRequestId
,
discussionId
);
}
}
};
...
...
@@ -771,7 +774,8 @@
.
closest
(
'
form
'
)
.
attr
(
'
data-discussion-id
'
,
discussionId
)
.
attr
(
'
data-resolve-all
'
,
'
true
'
)
.
attr
(
'
data-namespace
'
,
$this
.
attr
(
'
data-namespace
'
));
.
attr
(
'
data-namespace-path
'
,
$this
.
attr
(
'
data-namespace-path
'
))
.
attr
(
'
data-project-path
'
,
$this
.
attr
(
'
data-project-path
'
));
};
return
Notes
;
...
...
app/views/projects/merge_requests/_discussion.html.haml
浏览文件 @
5e860656
...
...
@@ -4,6 +4,6 @@
=
link_to
'Close merge request'
,
merge_request_path
(
@merge_request
,
merge_request:
{
state_event: :close
}),
method: :put
,
class:
"btn btn-nr btn-comment btn-close close-mr-link js-note-target-close"
,
title:
"Close merge request"
,
data:
{
original_text:
"Close merge request"
,
alternative_text:
"Comment & close merge request"
}
-
if
@merge_request
.
closed?
=
link_to
'Reopen merge request'
,
merge_request_path
(
@merge_request
,
merge_request:
{
state_event: :reopen
}),
method: :put
,
class:
"btn btn-nr btn-comment btn-reopen reopen-mr-link js-note-target-reopen"
,
title:
"Reopen merge request"
,
data:
{
original_text:
"Reopen merge request"
,
alternative_text:
"Comment & reopen merge request"
}
=
submit_tag
'Comment & resolve discussion'
,
class:
"btn btn-nr btn-create append-right-10 comment-btn js-comment-resolve-button"
,
data:
{
namespace
:
"
#{
@merge_request
.
project
.
namespace
.
path
}
/
#{
@merge_request
.
project
.
path
}
"
}
=
submit_tag
'Comment & resolve discussion'
,
class:
"btn btn-nr btn-create append-right-10 comment-btn js-comment-resolve-button"
,
data:
{
namespace
_path:
"
#{
@merge_request
.
project
.
namespace
.
path
}
"
,
project_path:
"
#{
@merge_request
.
project
.
path
}
"
}
#notes
=
render
"projects/notes/notes_with_form"
app/views/projects/notes/_form.html.haml
浏览文件 @
5e860656
...
...
@@ -5,6 +5,7 @@
=
f
.
hidden_field
:commit_id
=
f
.
hidden_field
:line_code
=
f
.
hidden_field
:noteable_id
=
hidden_field_tag
:noteable_iid
,
@note
.
noteable
.
iid
=
f
.
hidden_field
:noteable_type
=
f
.
hidden_field
:type
=
f
.
hidden_field
:position
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录