Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
33edde50
Commit
33edde50
authored
Aug 12, 2016
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don’t show “Resolve discussion” for non-author/members
parent
c80f5e0a
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
35 additions
and
14 deletions
+35
-14
app/assets/javascripts/diff_notes/components/comment_resolve_btn.js.es6
...ascripts/diff_notes/components/comment_resolve_btn.js.es6
+2
-4
app/assets/javascripts/diff_notes/components/resolve_discussion_btn.js.es6
...ripts/diff_notes/components/resolve_discussion_btn.js.es6
+9
-0
app/assets/javascripts/diff_notes/models/discussion.js.es6
app/assets/javascripts/diff_notes/models/discussion.js.es6
+6
-1
app/assets/javascripts/diff_notes/stores/comments.js.es6
app/assets/javascripts/diff_notes/stores/comments.js.es6
+10
-1
app/views/discussions/_resolve_all.html.haml
app/views/discussions/_resolve_all.html.haml
+8
-8
No files found.
app/assets/javascripts/diff_notes/components/comment_resolve_btn.js.es6
View file @
33edde50
...
...
@@ -9,10 +9,8 @@
return CommentsStore.state[this.discussionId];
},
showButton: function () {
if (!this.discussion) {
return false;
} else {
return this.discussion.canResolve();
if (this.discussion) {
return this.discussion.isResolvable();
}
},
isDiscussionResolved: function () {
...
...
app/assets/javascripts/diff_notes/components/resolve_discussion_btn.js.es6
View file @
33edde50
...
...
@@ -8,6 +8,7 @@
mergeRequestId: Number,
namespacePath: String,
projectPath: String,
canResolve: Boolean,
},
data: function() {
return {
...
...
@@ -18,6 +19,11 @@
discussion: function () {
return this.discussions[this.discussionId];
},
showButton: function () {
if (this.discussion) {
return this.discussion.isResolvable();
}
},
allResolved: function () {
if (this.discussion) {
return this.discussion.isResolved();
...
...
@@ -40,6 +46,9 @@
resolve: function () {
ResolveService.toggleResolveForDiscussion(this.namespace, this.mergeRequestId, this.discussionId);
}
},
created: function () {
CommentsStore.createDiscussion(this.discussionId, this.canResolve);
}
});
})(window);
app/assets/javascripts/diff_notes/models/discussion.js.es6
View file @
33edde50
...
...
@@ -3,6 +3,7 @@ class DiscussionModel {
this.id = discussionId;
this.notes = {};
this.loading = false;
this.canResolve = false;
}
createNote (noteId, canResolve, resolved, resolved_by) {
...
...
@@ -68,7 +69,11 @@ class DiscussionModel {
}
}
canResolve () {
isResolvable () {
if (!this.canResolve) {
return false;
}
for (const noteId in this.notes) {
const note = this.notes[noteId];
...
...
app/assets/javascripts/diff_notes/stores/comments.js.es6
View file @
33edde50
...
...
@@ -4,13 +4,22 @@
get: function (discussionId, noteId) {
return this.state[discussionId].getNote(noteId);
},
create
: function (discussionId, noteId, canResolve, resolved, resolved_by
) {
create
Discussion: function (discussionId, canResolve
) {
let discussion = this.state[discussionId];
if (!this.state[discussionId]) {
discussion = new DiscussionModel(discussionId);
Vue.set(this.state, discussionId, discussion);
}
if (canResolve !== undefined) {
discussion.canResolve = canResolve;
}
return discussion;
},
create: function (discussionId, noteId, canResolve, resolved, resolved_by) {
const discussion = this.createDiscussion(discussionId);
discussion.createNote(noteId, canResolve, resolved, resolved_by);
},
update: function (discussionId, noteId, resolved, resolved_by) {
...
...
app/views/discussions/_resolve_all.html.haml
View file @
33edde50
-
if
discussion
.
can_resolve?
(
current_user
)
.btn-group
{
role:
"group"
}
%resolve-discussion-btn
{
":namespace-path"
=>
"'#{discussion.project.namespace
.path}'"
,
":project-path"
=>
"'#{discussion.project.path
}'"
,
":discussion-id"
=>
"'#{discussion.id}'"
,
":merge-request-id"
=>
"#{discussion.noteable.iid}"
,
"inline-template"
=>
true
,
"v-cloak"
=>
true
}
-
if
discussion
.
for_merge_request?
%resolve-discussion-btn
{
":namespace-path"
=>
"'#{discussion.project.namespace.path}'"
,
":project-path"
=>
"'#{discussion.project
.path}'"
,
":discussion-id"
=>
"'#{discussion.id
}'"
,
":merge-request-id"
=>
discussion
.
noteable
.
iid
,
":can-resolve"
=>
discussion
.
can_resolve?
(
current_user
)
,
"inline-template"
=>
true
}
.btn-group
{
role:
"group"
,
"v-if"
=>
"showButton"
}
%button
.btn.btn-default
{
type:
"button"
,
"@click"
=>
"resolve"
,
":disabled"
=>
"loading"
}
=
icon
(
"spinner spin"
,
"v-show"
=>
"loading"
)
{{ buttonText }}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment