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
Léo-Paul Géneau
gitlab-ce
Commits
4e679819
Commit
4e679819
authored
Jul 29, 2016
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed failing tests
parent
efb74875
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
17 additions
and
29 deletions
+17
-29
app/assets/javascripts/diff_notes/components/resolve_comment_btn.js.es6
...ascripts/diff_notes/components/resolve_comment_btn.js.es6
+1
-2
app/assets/javascripts/diff_notes/components/resolve_discussion_btn.js.es6
...ripts/diff_notes/components/resolve_discussion_btn.js.es6
+2
-3
app/assets/javascripts/diff_notes/diff_notes_bundle.js.es6
app/assets/javascripts/diff_notes/diff_notes_bundle.js.es6
+1
-1
app/assets/javascripts/diff_notes/models/disucssion.js.es6
app/assets/javascripts/diff_notes/models/disucssion.js.es6
+1
-0
app/assets/javascripts/diff_notes/models/note.js.es6
app/assets/javascripts/diff_notes/models/note.js.es6
+0
-0
app/assets/javascripts/diff_notes/services/resolve.js.es6
app/assets/javascripts/diff_notes/services/resolve.js.es6
+8
-9
app/assets/javascripts/diff_notes/stores/comments.js.es6
app/assets/javascripts/diff_notes/stores/comments.js.es6
+0
-3
app/views/projects/notes/_note.html.haml
app/views/projects/notes/_note.html.haml
+2
-1
spec/features/merge_requests/diff_notes_resolve_spec.rb
spec/features/merge_requests/diff_notes_resolve_spec.rb
+2
-10
No files found.
app/assets/javascripts/diff_notes/components/resolve_comment_btn.js.es6
View file @
4e679819
...
@@ -5,8 +5,7 @@
...
@@ -5,8 +5,7 @@
},
},
computed: {
computed: {
isDiscussionResolved: function () {
isDiscussionResolved: function () {
const discussion = CommentsStore.state[this.discussionId],
const discussion = CommentsStore.state[this.discussionId];
notes = CommentsStore.notesForDiscussion(this.discussionId);
return discussion.isResolved();
return discussion.isResolved();
},
},
...
...
app/assets/javascripts/diff_notes/components/resolve_discussion_btn.js.es6
View file @
4e679819
...
@@ -11,8 +11,7 @@
...
@@ -11,8 +11,7 @@
},
},
data: function() {
data: function() {
return {
return {
discussions: CommentsStore.state,
discussions: CommentsStore.state
loadingObject: CommentsStore.loading,
};
};
},
},
computed: {
computed: {
...
@@ -27,7 +26,7 @@
...
@@ -27,7 +26,7 @@
}
}
},
},
loading: function () {
loading: function () {
return this.
loadingObject[this.discussionId]
;
return this.
discussions[this.discussionId].loading
;
}
}
},
},
methods: {
methods: {
...
...
app/assets/javascripts/diff_notes/diff_notes_bundle.js.es6
View file @
4e679819
...
@@ -27,7 +27,7 @@ $(() => {
...
@@ -27,7 +27,7 @@ $(() => {
const $components = $('resolve-btn, resolve-discussion-btn, jump-to-discussion');
const $components = $('resolve-btn, resolve-discussion-btn, jump-to-discussion');
if ($components.length) {
if ($components.length) {
$components.each(function () {
$components.each(function () {
DiffNotesApp.$compile($(this).get(0))
DiffNotesApp.$compile($(this).get(0))
;
});
});
}
}
}
}
...
...
app/assets/javascripts/diff_notes/models/disucssion.js.es6
View file @
4e679819
...
@@ -2,6 +2,7 @@ class DiscussionModel {
...
@@ -2,6 +2,7 @@ class DiscussionModel {
constructor (discussionId) {
constructor (discussionId) {
this.discussionId = discussionId;
this.discussionId = discussionId;
this.notes = {};
this.notes = {};
this.loading = false;
}
}
createNote (noteId, resolved, user) {
createNote (noteId, resolved, user) {
...
...
app/assets/javascripts/diff_notes/models/note.js
→
app/assets/javascripts/diff_notes/models/note.js
.es6
View file @
4e679819
File moved
app/assets/javascripts/diff_notes/services/resolve.js.es6
View file @
4e679819
...
@@ -34,10 +34,12 @@
...
@@ -34,10 +34,12 @@
}
}
resolveAll(namespace, mergeRequestId, discussionId) {
resolveAll(namespace, mergeRequestId, discussionId) {
const discussion = CommentsStore.state[discussionId];
this.setCSRF();
this.setCSRF();
Vue.http.options.root = `/${namespace}`;
Vue.http.options.root = `/${namespace}`;
CommentsStore.loading[discussionId]
= true;
discussion.loading
= true;
return this.discussionResource.save({
return this.discussionResource.save({
mergeRequestId,
mergeRequestId,
...
@@ -45,31 +47,28 @@
...
@@ -45,31 +47,28 @@
}, {}).then((response) => {
}, {}).then((response) => {
const data = response.data;
const data = response.data;
const user = data ? data.resolved_by : null;
const user = data ? data.resolved_by : null;
const discussion = CommentsStore.state[discussionId];
discussion.resolveAllNotes(user);
discussion.resolveAllNotes(user);
discussion.loading = false;
CommentsStore.loading[discussionId] = false;
this.updateUpdatedHtml(discussionId, data);
this.updateUpdatedHtml(discussionId, data);
});
});
}
}
unResolveAll(namespace, mergeRequestId, discussionId) {
unResolveAll(namespace, mergeRequestId, discussionId) {
const discussion = CommentsStore.state[discussionId];
this.setCSRF();
this.setCSRF();
Vue.http.options.root = `/${namespace}`;
Vue.http.options.root = `/${namespace}`;
CommentsStore.loading[discussionId]
= true;
discussion.loading
= true;
return this.discussionResource.delete({
return this.discussionResource.delete({
mergeRequestId,
mergeRequestId,
discussionId
discussionId
}, {}).then((response) => {
}, {}).then((response) => {
const data = response.data;
const data = response.data;
const discussion = CommentsStore.state[discussionId];
discussion.unResolveAllNotes();
discussion.unResolveAllNotes();
discussion.loading = false;
CommentsStore.loading[discussionId] = false;
this.updateUpdatedHtml(discussionId, data);
this.updateUpdatedHtml(discussionId, data);
});
});
...
...
app/assets/javascripts/diff_notes/stores/comments.js.es6
View file @
4e679819
((w) => {
((w) => {
w.CommentsStore = {
w.CommentsStore = {
state: {},
state: {},
loading: {},
get: function (discussionId, noteId) {
get: function (discussionId, noteId) {
return this.state[discussionId].getNote(noteId);
return this.state[discussionId].getNote(noteId);
},
},
...
@@ -10,7 +9,6 @@
...
@@ -10,7 +9,6 @@
if (!this.state[discussionId]) {
if (!this.state[discussionId]) {
discussion = new DiscussionModel(discussionId);
discussion = new DiscussionModel(discussionId);
Vue.set(this.state, discussionId, discussion);
Vue.set(this.state, discussionId, discussion);
Vue.set(this.loading, discussionId, false);
}
}
discussion.createNote(noteId, resolved, user);
discussion.createNote(noteId, resolved, user);
...
@@ -27,7 +25,6 @@
...
@@ -27,7 +25,6 @@
if (Object.keys(discussion.notes).length === 0) {
if (Object.keys(discussion.notes).length === 0) {
Vue.delete(this.state, discussionId);
Vue.delete(this.state, discussionId);
Vue.delete(this.loading, discussionId);
}
}
}
}
};
};
...
...
app/views/projects/notes/_note.html.haml
View file @
4e679819
...
@@ -22,7 +22,7 @@
...
@@ -22,7 +22,7 @@
-
if
access
-
if
access
%span
.note-role.hidden-xs
=
access
%span
.note-role.hidden-xs
=
access
-
if
(
note
.
resolvable?
&&
can?
(
current_user
,
:resolve_note
,
note
))
||
(
note
.
resolved?
&&
!
can?
(
current_user
,
:resolve_note
,
note
))
-
if
note
.
resolvable?
%resolve-btn
{
":namespace-path"
=>
"'#{note.project.namespace.path}'"
,
%resolve-btn
{
":namespace-path"
=>
"'#{note.project.namespace.path}'"
,
":project-path"
=>
"'#{note.project.path}'"
,
":project-path"
=>
"'#{note.project.path}'"
,
":discussion-id"
=>
"'#{note.discussion_id}'"
,
":discussion-id"
=>
"'#{note.discussion_id}'"
,
...
@@ -30,6 +30,7 @@
...
@@ -30,6 +30,7 @@
":resolved"
=>
note
.
resolved?
,
":resolved"
=>
note
.
resolved?
,
":can-resolve"
=>
can?
(
current_user
,
:resolve_note
,
note
),
":can-resolve"
=>
can?
(
current_user
,
:resolve_note
,
note
),
":resolved-by"
=>
"'#{note.resolved_by.try(:name)}'"
,
":resolved-by"
=>
"'#{note.resolved_by.try(:name)}'"
,
"v-show"
=>
"#{(note.resolvable? && can?(current_user, :resolve_note, note)) || (note.resolved? && !can?(current_user, :resolve_note, note))}"
,
"inline-template"
=>
true
,
"inline-template"
=>
true
,
"v-ref:note_#{note.id}"
=>
true
}
"v-ref:note_#{note.id}"
=>
true
}
...
...
spec/features/merge_requests/diff_notes_resolve_spec.rb
View file @
4e679819
...
@@ -332,11 +332,7 @@ feature 'Diff notes resolve', feature: true, js: true do
...
@@ -332,11 +332,7 @@ feature 'Diff notes resolve', feature: true, js: true do
it
'does not allow user to mark note as resolved'
do
it
'does not allow user to mark note as resolved'
do
page
.
within
'.diff-content .note'
do
page
.
within
'.diff-content .note'
do
expect
(
page
).
to
have_selector
(
'.line-resolve-btn.is-disabled'
)
expect
(
page
).
not_to
have_selector
(
'.line-resolve-btn'
)
find
(
'.line-resolve-btn'
).
click
expect
(
page
).
to
have_selector
(
'.line-resolve-btn.is-disabled'
)
end
end
page
.
within
'.line-resolve-all-container'
do
page
.
within
'.line-resolve-all-container'
do
...
@@ -384,11 +380,7 @@ feature 'Diff notes resolve', feature: true, js: true do
...
@@ -384,11 +380,7 @@ feature 'Diff notes resolve', feature: true, js: true do
it
'does not allow user to mark note as resolved'
do
it
'does not allow user to mark note as resolved'
do
page
.
within
'.diff-content .note'
do
page
.
within
'.diff-content .note'
do
expect
(
page
).
to
have_selector
(
'.line-resolve-btn.is-disabled'
)
expect
(
page
).
not_to
have_selector
(
'.line-resolve-btn'
)
find
(
'.line-resolve-btn'
).
click
expect
(
page
).
to
have_selector
(
'.line-resolve-btn.is-disabled'
)
end
end
page
.
within
'.line-resolve-all-container'
do
page
.
within
'.line-resolve-all-container'
do
...
...
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