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
a678fef8
Commit
a678fef8
authored
Jul 26, 2016
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added resolved by users name into tooltip
parent
5e860656
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
65 additions
and
44 deletions
+65
-44
app/assets/javascripts/diff_notes/components/resolve_all_btn.js.es6
.../javascripts/diff_notes/components/resolve_all_btn.js.es6
+1
-1
app/assets/javascripts/diff_notes/components/resolve_btn.js.es6
...sets/javascripts/diff_notes/components/resolve_btn.js.es6
+23
-10
app/assets/javascripts/diff_notes/services/resolve.js.es6
app/assets/javascripts/diff_notes/services/resolve.js.es6
+4
-2
app/assets/javascripts/diff_notes/stores/comments.js.es6
app/assets/javascripts/diff_notes/stores/comments.js.es6
+8
-7
app/assets/stylesheets/pages/notes.scss
app/assets/stylesheets/pages/notes.scss
+1
-1
app/controllers/projects/discussions_controller.rb
app/controllers/projects/discussions_controller.rb
+3
-1
app/controllers/projects/notes_controller.rb
app/controllers/projects/notes_controller.rb
+3
-1
app/views/discussions/_resolve_all.html.haml
app/views/discussions/_resolve_all.html.haml
+1
-1
app/views/projects/notes/_note.html.haml
app/views/projects/notes/_note.html.haml
+21
-20
No files found.
app/assets/javascripts/diff_notes/components/resolve_all_btn.js.es6
View file @
a678fef8
...
@@ -19,7 +19,7 @@
...
@@ -19,7 +19,7 @@
allResolved: function () {
allResolved: function () {
let isResolved = true;
let isResolved = true;
for (const noteId in this.comments[this.discussionId]) {
for (const noteId in this.comments[this.discussionId]) {
const resolved = this.comments[this.discussionId][noteId];
const resolved = this.comments[this.discussionId][noteId]
.resolved
;
if (!resolved) {
if (!resolved) {
isResolved = false;
isResolved = false;
...
...
app/assets/javascripts/diff_notes/components/resolve_btn.js.es6
View file @
a678fef8
...
@@ -9,6 +9,8 @@
...
@@ -9,6 +9,8 @@
resolved: Boolean,
resolved: Boolean,
namespacePath: String,
namespacePath: String,
projectPath: String,
projectPath: String,
canResolve: Boolean,
resolvedBy: String
},
},
data: function () {
data: function () {
return {
return {
...
@@ -18,19 +20,24 @@
...
@@ -18,19 +20,24 @@
},
},
computed: {
computed: {
buttonText: function () {
buttonText: function () {
if (!this.canResolve) return;
if (this.isResolved) {
if (this.isResolved) {
return
"Mark as unresolved"
;
return
`Resolved by ${this.resolvedByName}`
;
} else {
} else {
return
"Mark as resolved"
;
return
'Mark as resolved'
;
}
}
},
},
isResolved: function () { return CommentsStore.get(this.discussionId, this.noteId); },
isResolved: function () { return CommentsStore.get(this.discussionId, this.noteId).resolved; },
resolvedByName: function () { return CommentsStore.get(this.discussionId, this.noteId).user; },
},
},
methods: {
methods: {
updateTooltip: function () {
updateTooltip: function () {
if (this.canResolve) {
$(this.$els.button)
$(this.$els.button)
.tooltip('hide')
.tooltip('hide')
.tooltip('fixTitle');
.tooltip('fixTitle');
}
},
},
resolve: function () {
resolve: function () {
let promise;
let promise;
...
@@ -45,10 +52,12 @@
...
@@ -45,10 +52,12 @@
}
}
promise.then((response) => {
promise.then((response) => {
const data = response.data;
const user = data ? data.resolved_by : null;
this.loading = false;
this.loading = false;
if (response.status === 200) {
if (response.status === 200) {
CommentsStore.update(this.discussionId, this.noteId, !this.isResolved);
CommentsStore.update(this.discussionId, this.noteId, !this.isResolved
, user
);
}
}
this.$nextTick(this.updateTooltip);
this.$nextTick(this.updateTooltip);
...
@@ -56,13 +65,17 @@
...
@@ -56,13 +65,17 @@
}
}
},
},
compiled: function () {
compiled: function () {
$(this.$els.button).tooltip();
if (this.canResolve) {
$(this.$els.button).tooltip({
container: 'body'
});
}
},
},
destroyed: function () {
destroyed: function () {
CommentsStore.delete(this.discussionId, this.noteId)
CommentsStore.delete(this.discussionId, this.noteId)
;
},
},
created: function () {
created: function () {
CommentsStore.create(this.discussionId, this.noteId, this.resolved
)
CommentsStore.create(this.discussionId, this.noteId, this.resolved
, this.resolvedBy);
}
}
});
});
}(window));
}(window));
app/assets/javascripts/diff_notes/services/resolve.js.es6
View file @
a678fef8
...
@@ -28,7 +28,7 @@
...
@@ -28,7 +28,7 @@
let isResolved = true;
let isResolved = true;
for (const noteId of noteIds) {
for (const noteId of noteIds) {
const resolved = CommentsStore.state[discussionId][noteId];
const resolved = CommentsStore.state[discussionId][noteId]
.resolved
;
if (!resolved) {
if (!resolved) {
isResolved = false;
isResolved = false;
...
@@ -52,9 +52,11 @@
...
@@ -52,9 +52,11 @@
mergeRequestId,
mergeRequestId,
discussionId
discussionId
}, {}).then((response) => {
}, {}).then((response) => {
const data = response.data;
const user = data ? data.resolved_by : null;
CommentsStore.loading[discussionId] = false;
CommentsStore.loading[discussionId] = false;
CommentsStore.updateCommentsForDiscussion(discussionId, true);
CommentsStore.updateCommentsForDiscussion(discussionId, true
, user
);
});
});
}
}
...
...
app/assets/javascripts/diff_notes/stores/comments.js.es6
View file @
a678fef8
...
@@ -5,16 +5,17 @@
...
@@ -5,16 +5,17 @@
get: function (discussionId, noteId) {
get: function (discussionId, noteId) {
return this.state[discussionId][noteId];
return this.state[discussionId][noteId];
},
},
create: function (discussionId, noteId, resolved) {
create: function (discussionId, noteId, resolved
, user
) {
if (!this.state[discussionId]) {
if (!this.state[discussionId]) {
Vue.set(this.state, discussionId, {});
Vue.set(this.state, discussionId, {});
Vue.set(this.loading, discussionId, false);
Vue.set(this.loading, discussionId, false);
}
}
Vue.set(this.state[discussionId], noteId,
resolved
);
Vue.set(this.state[discussionId], noteId,
{ resolved, user}
);
},
},
update: function (discussionId, noteId, resolved) {
update: function (discussionId, noteId, resolved, user) {
this.state[discussionId][noteId] = resolved;
this.state[discussionId][noteId].resolved = resolved;
this.state[discussionId][noteId].user = user;
},
},
delete: function (discussionId, noteId) {
delete: function (discussionId, noteId) {
Vue.delete(this.state[discussionId], noteId);
Vue.delete(this.state[discussionId], noteId);
...
@@ -24,11 +25,11 @@
...
@@ -24,11 +25,11 @@
Vue.delete(this.loading, discussionId);
Vue.delete(this.loading, discussionId);
}
}
},
},
updateCommentsForDiscussion: function (discussionId, resolve) {
updateCommentsForDiscussion: function (discussionId, resolve
, user
) {
const noteIds = CommentsStore.resolvedNotesForDiscussion(discussionId, resolve);
const noteIds = CommentsStore.resolvedNotesForDiscussion(discussionId, resolve);
for (const noteId of noteIds) {
for (const noteId of noteIds) {
CommentsStore.update(discussionId, noteId, resolve);
CommentsStore.update(discussionId, noteId, resolve
, user
);
}
}
},
},
notesForDiscussion: function (discussionId) {
notesForDiscussion: function (discussionId) {
...
@@ -44,7 +45,7 @@
...
@@ -44,7 +45,7 @@
let ids = [];
let ids = [];
for (const noteId in CommentsStore.state[discussionId]) {
for (const noteId in CommentsStore.state[discussionId]) {
const resolved = CommentsStore.state[discussionId][noteId];
const resolved = CommentsStore.state[discussionId][noteId]
.resolved
;
if (resolved !== resolve) {
if (resolved !== resolve) {
ids.push(noteId);
ids.push(noteId);
...
...
app/assets/stylesheets/pages/notes.scss
View file @
a678fef8
...
@@ -411,7 +411,7 @@ ul.notes {
...
@@ -411,7 +411,7 @@ ul.notes {
outline
:
0
;
outline
:
0
;
vertical-align
:
middle
;
vertical-align
:
middle
;
&
:hover
,
&
:
not
(
.is-disabled
)
:
hover
,
&
.is-active
{
&
.is-active
{
color
:
#fff
;
color
:
#fff
;
background-color
:
$gl-text-green
;
background-color
:
$gl-text-green
;
...
...
app/controllers/projects/discussions_controller.rb
View file @
a678fef8
...
@@ -9,7 +9,9 @@ class Projects::DiscussionsController < Projects::ApplicationController
...
@@ -9,7 +9,9 @@ class Projects::DiscussionsController < Projects::ApplicationController
discussion
.
resolve!
(
current_user
)
discussion
.
resolve!
(
current_user
)
head
:ok
render
json:
{
resolved_by:
discussion
.
resolved_by
.
try
(
:name
)
}
end
end
def
unresolve
def
unresolve
...
...
app/controllers/projects/notes_controller.rb
View file @
a678fef8
...
@@ -72,7 +72,9 @@ class Projects::NotesController < Projects::ApplicationController
...
@@ -72,7 +72,9 @@ class Projects::NotesController < Projects::ApplicationController
note
.
resolve!
(
current_user
)
note
.
resolve!
(
current_user
)
head
:ok
render
json:
{
resolved_by:
note
.
resolved_by
.
try
(
:name
)
}
end
end
def
unresolve
def
unresolve
...
...
app/views/discussions/_resolve_all.html.haml
View file @
a678fef8
-
if
discussion
.
can_resolve?
(
current_user
)
-
if
discussion
.
can_resolve?
(
current_user
)
&&
discussion
.
resolvable?
%resolve-all-btn
{
":namespace-path"
=>
"'#{discussion.project.namespace.path}'"
,
%resolve-all-btn
{
":namespace-path"
=>
"'#{discussion.project.namespace.path}'"
,
":project-path"
=>
"'#{discussion.project.path}'"
,
":project-path"
=>
"'#{discussion.project.path}'"
,
":discussion-id"
=>
"'#{discussion.id}'"
,
":discussion-id"
=>
"'#{discussion.id}'"
,
...
...
app/views/projects/notes/_note.html.haml
View file @
a678fef8
...
@@ -23,28 +23,29 @@
...
@@ -23,28 +23,29 @@
%span
.note-role.hidden-xs
=
access
%span
.note-role.hidden-xs
=
access
-
if
note
.
resolvable?
-
if
note
.
resolvable?
-
if
can?
(
current_user
,
:resolve_note
,
note
)
%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}'"
,
":note-id"
=>
note
.
id
,
":note-id"
=>
note
.
id
,
":resolved"
=>
note
.
resolved?
,
":resolved"
=>
note
.
resolved?
,
":can-resolve"
=>
can?
(
current_user
,
:resolve_note
,
note
),
":resolved-by"
=>
"'#{note.resolved_by.try(:name)}'"
,
"inline-template"
=>
true
,
"inline-template"
=>
true
,
"v-ref:note_#{note.id}"
=>
true
}
"v-ref:note_#{note.id}"
=>
true
}
.note-action-button
.note-action-button
=
icon
(
"spin spinner"
,
"v-show"
=>
"loading"
)
=
icon
(
"spin spinner"
,
"v-show"
=>
"loading"
)
%button
.line-resolve-btn
{
type:
"button"
,
%button
.line-resolve-btn
{
type:
"button"
,
class:
(
"is-disabled"
if
!
can?
(
current_user
,
:resolve_note
,
note
)),
":class"
=>
"{ 'is-active': isResolved }"
,
":class"
=>
"{ 'is-active': isResolved }"
,
":aria-label"
=>
"buttonText"
,
":aria-label"
=>
"buttonText"
,
":disabled"
=>
!
can?
(
current_user
,
:resolve_note
,
note
),
"@click"
=>
"resolve"
,
"@click"
=>
"resolve"
,
":title"
=>
"buttonText"
,
":title"
=>
"buttonText"
,
"v-show"
=>
"!loading"
,
"v-show"
=>
"!loading"
,
"v-el:button"
=>
true
}
"v-el:button"
=>
true
}
=
icon
(
"check"
)
=
icon
(
"check"
)
-
else
-# TODO: Just render status
-
if
current_user
-
if
current_user
-
if
note
.
emoji_awardable?
-
if
note
.
emoji_awardable?
...
...
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