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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
8441fc47
Commit
8441fc47
authored
Feb 18, 2019
by
Winnie Hellmann
Committed by
Phil Hughes
Feb 18, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove noteId prop from ReplyButton component
Move convertToDiscussion call from ReplyButton to NoteApp component
parent
e52f97a9
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
37 additions
and
49 deletions
+37
-49
app/assets/javascripts/notes/components/note_actions.vue
app/assets/javascripts/notes/components/note_actions.vue
+1
-6
app/assets/javascripts/notes/components/note_actions/reply_button.vue
...avascripts/notes/components/note_actions/reply_button.vue
+1
-11
app/assets/javascripts/notes/components/noteable_discussion.vue
...sets/javascripts/notes/components/noteable_discussion.vue
+13
-0
app/assets/javascripts/notes/components/noteable_note.vue
app/assets/javascripts/notes/components/noteable_note.vue
+6
-13
app/assets/javascripts/notes/components/notes_app.vue
app/assets/javascripts/notes/components/notes_app.vue
+12
-1
spec/javascripts/notes/components/note_actions/reply_button_spec.js
...cripts/notes/components/note_actions/reply_button_spec.js
+4
-18
No files found.
app/assets/javascripts/notes/components/note_actions.vue
View file @
8441fc47
...
@@ -23,11 +23,6 @@ export default {
...
@@ -23,11 +23,6 @@ export default {
type
:
[
String
,
Number
],
type
:
[
String
,
Number
],
required
:
true
,
required
:
true
,
},
},
discussionId
:
{
type
:
String
,
required
:
false
,
default
:
''
,
},
noteUrl
:
{
noteUrl
:
{
type
:
String
,
type
:
String
,
required
:
false
,
required
:
false
,
...
@@ -176,7 +171,7 @@ export default {
...
@@ -176,7 +171,7 @@ export default {
v-if=
"showReplyButton"
v-if=
"showReplyButton"
ref=
"replyButton"
ref=
"replyButton"
class=
"js-reply-button"
class=
"js-reply-button"
:note-id=
"discussionId
"
@
startReplying=
"$emit('startReplying')
"
/>
/>
<div
v-if=
"canEdit"
class=
"note-actions-item"
>
<div
v-if=
"canEdit"
class=
"note-actions-item"
>
<button
<button
...
...
app/assets/javascripts/notes/components/note_actions/reply_button.vue
View file @
8441fc47
<
script
>
<
script
>
import
{
mapActions
}
from
'
vuex
'
;
import
{
GlTooltipDirective
,
GlButton
}
from
'
@gitlab/ui
'
;
import
{
GlTooltipDirective
,
GlButton
}
from
'
@gitlab/ui
'
;
import
Icon
from
'
~/vue_shared/components/icon.vue
'
;
import
Icon
from
'
~/vue_shared/components/icon.vue
'
;
...
@@ -12,15 +11,6 @@ export default {
...
@@ -12,15 +11,6 @@ export default {
directives
:
{
directives
:
{
GlTooltip
:
GlTooltipDirective
,
GlTooltip
:
GlTooltipDirective
,
},
},
props
:
{
noteId
:
{
type
:
String
,
required
:
true
,
},
},
methods
:
{
...
mapActions
([
'
convertToDiscussion
'
]),
},
};
};
</
script
>
</
script
>
...
@@ -32,7 +22,7 @@ export default {
...
@@ -32,7 +22,7 @@ export default {
class=
"note-action-button"
class=
"note-action-button"
variant=
"transparent"
variant=
"transparent"
:title=
"__('Reply to comment')"
:title=
"__('Reply to comment')"
@
click=
"
convertToDiscussion(noteId
)"
@
click=
"
$emit('startReplying'
)"
>
>
<icon
name=
"comment"
css-classes=
"link-highlight"
/>
<icon
name=
"comment"
css-classes=
"link-highlight"
/>
</gl-button>
</gl-button>
...
...
app/assets/javascripts/notes/components/noteable_discussion.vue
View file @
8441fc47
...
@@ -26,6 +26,7 @@ import resolvable from '../mixins/resolvable';
...
@@ -26,6 +26,7 @@ import resolvable from '../mixins/resolvable';
import
discussionNavigation
from
'
../mixins/discussion_navigation
'
;
import
discussionNavigation
from
'
../mixins/discussion_navigation
'
;
import
ReplyPlaceholder
from
'
./discussion_reply_placeholder.vue
'
;
import
ReplyPlaceholder
from
'
./discussion_reply_placeholder.vue
'
;
import
jumpToNextDiscussionButton
from
'
./discussion_jump_to_next_button.vue
'
;
import
jumpToNextDiscussionButton
from
'
./discussion_jump_to_next_button.vue
'
;
import
eventHub
from
'
../event_hub
'
;
export
default
{
export
default
{
name
:
'
NoteableDiscussion
'
,
name
:
'
NoteableDiscussion
'
,
...
@@ -246,6 +247,12 @@ export default {
...
@@ -246,6 +247,12 @@ export default {
}
}
},
},
},
},
created
()
{
eventHub
.
$on
(
'
startReplying
'
,
this
.
onStartReplying
);
},
beforeDestroy
()
{
eventHub
.
$off
(
'
startReplying
'
,
this
.
onStartReplying
);
},
methods
:
{
methods
:
{
...
mapActions
([
...
mapActions
([
'
saveNote
'
,
'
saveNote
'
,
...
@@ -350,6 +357,11 @@ Please check your network connection and try again.`;
...
@@ -350,6 +357,11 @@ Please check your network connection and try again.`;
deleteNoteHandler
(
note
)
{
deleteNoteHandler
(
note
)
{
this
.
$emit
(
'
noteDeleted
'
,
this
.
discussion
,
note
);
this
.
$emit
(
'
noteDeleted
'
,
this
.
discussion
,
note
);
},
},
onStartReplying
(
discussionId
)
{
if
(
this
.
discussion
.
id
===
discussionId
)
{
this
.
showReplyForm
();
}
},
},
},
};
};
</
script
>
</
script
>
...
@@ -412,6 +424,7 @@ Please check your network connection and try again.`;
...
@@ -412,6 +424,7 @@ Please check your network connection and try again.`;
:help-page-path=
"helpPagePath"
:help-page-path=
"helpPagePath"
:show-reply-button=
"canReply"
:show-reply-button=
"canReply"
@
handleDeleteNote=
"deleteNoteHandler"
@
handleDeleteNote=
"deleteNoteHandler"
@
startReplying=
"showReplyForm"
>
>
<note-edited-text
<note-edited-text
v-if=
"discussion.resolved"
v-if=
"discussion.resolved"
...
...
app/assets/javascripts/notes/components/noteable_note.vue
View file @
8441fc47
...
@@ -29,11 +29,6 @@ export default {
...
@@ -29,11 +29,6 @@ export default {
type
:
Object
,
type
:
Object
,
required
:
true
,
required
:
true
,
},
},
discussion
:
{
type
:
Object
,
required
:
false
,
default
:
null
,
},
line
:
{
line
:
{
type
:
Object
,
type
:
Object
,
required
:
false
,
required
:
false
,
...
@@ -49,6 +44,11 @@ export default {
...
@@ -49,6 +44,11 @@ export default {
required
:
false
,
required
:
false
,
default
:
()
=>
null
,
default
:
()
=>
null
,
},
},
showReplyButton
:
{
type
:
Boolean
,
required
:
false
,
default
:
false
,
},
},
},
data
()
{
data
()
{
return
{
return
{
...
@@ -91,13 +91,6 @@ export default {
...
@@ -91,13 +91,6 @@ export default {
}
}
return
''
;
return
''
;
},
},
showReplyButton
()
{
if
(
!
this
.
discussion
||
!
this
.
getNoteableData
.
current_user
.
can_create_note
)
{
return
false
;
}
return
this
.
discussion
.
individual_note
&&
!
this
.
commentsDisabled
;
},
actionText
()
{
actionText
()
{
if
(
!
this
.
commit
)
{
if
(
!
this
.
commit
)
{
return
''
;
return
''
;
...
@@ -260,10 +253,10 @@ export default {
...
@@ -260,10 +253,10 @@ export default {
:is-resolved=
"note.resolved"
:is-resolved=
"note.resolved"
:is-resolving=
"isResolving"
:is-resolving=
"isResolving"
:resolved-by=
"note.resolved_by"
:resolved-by=
"note.resolved_by"
:discussion-id=
"discussionId"
@
handleEdit=
"editHandler"
@
handleEdit=
"editHandler"
@
handleDelete=
"deleteHandler"
@
handleDelete=
"deleteHandler"
@
handleResolve=
"resolveHandler"
@
handleResolve=
"resolveHandler"
@
startReplying=
"$emit('startReplying')"
/>
/>
</div>
</div>
<div
class=
"timeline-discussion-body"
>
<div
class=
"timeline-discussion-body"
>
...
...
app/assets/javascripts/notes/components/notes_app.vue
View file @
8441fc47
...
@@ -64,6 +64,7 @@ export default {
...
@@ -64,6 +64,7 @@ export default {
'
getNotesDataByProp
'
,
'
getNotesDataByProp
'
,
'
isLoading
'
,
'
isLoading
'
,
'
commentsDisabled
'
,
'
commentsDisabled
'
,
'
getNoteableData
'
,
]),
]),
noteableType
()
{
noteableType
()
{
return
this
.
noteableData
.
noteableType
;
return
this
.
noteableData
.
noteableType
;
...
@@ -79,6 +80,9 @@ export default {
...
@@ -79,6 +80,9 @@ export default {
return
this
.
discussions
;
return
this
.
discussions
;
},
},
canReply
()
{
return
this
.
getNoteableData
.
current_user
.
can_create_note
&&
!
this
.
commentsDisabled
;
},
},
},
watch
:
{
watch
:
{
shouldShow
()
{
shouldShow
()
{
...
@@ -129,6 +133,7 @@ export default {
...
@@ -129,6 +133,7 @@ export default {
'
setNotesFetchedState
'
,
'
setNotesFetchedState
'
,
'
expandDiscussion
'
,
'
expandDiscussion
'
,
'
startTaskList
'
,
'
startTaskList
'
,
'
convertToDiscussion
'
,
]),
]),
fetchNotes
()
{
fetchNotes
()
{
if
(
this
.
isFetching
)
return
null
;
if
(
this
.
isFetching
)
return
null
;
...
@@ -176,6 +181,11 @@ export default {
...
@@ -176,6 +181,11 @@ export default {
}
}
}
}
},
},
startReplying
(
discussionId
)
{
return
this
.
convertToDiscussion
(
discussionId
)
.
then
(()
=>
this
.
$nextTick
())
.
then
(()
=>
eventHub
.
$emit
(
'
startReplying
'
,
discussionId
));
},
},
},
systemNote
:
constants
.
SYSTEM_NOTE
,
systemNote
:
constants
.
SYSTEM_NOTE
,
};
};
...
@@ -206,7 +216,8 @@ export default {
...
@@ -206,7 +216,8 @@ export default {
v-else
v-else
:key=
"discussion.id"
:key=
"discussion.id"
:note=
"discussion.notes[0]"
:note=
"discussion.notes[0]"
:discussion=
"discussion"
:show-reply-button=
"canReply"
@
startReplying=
"startReplying(discussion.id)"
/>
/>
</
template
>
</
template
>
<noteable-discussion
<noteable-discussion
...
...
spec/javascripts/notes/components/note_actions/reply_button_spec.js
View file @
8441fc47
...
@@ -3,27 +3,14 @@ import { createLocalVue, mount } from '@vue/test-utils';
...
@@ -3,27 +3,14 @@ import { createLocalVue, mount } from '@vue/test-utils';
import
ReplyButton
from
'
~/notes/components/note_actions/reply_button.vue
'
;
import
ReplyButton
from
'
~/notes/components/note_actions/reply_button.vue
'
;
describe
(
'
ReplyButton
'
,
()
=>
{
describe
(
'
ReplyButton
'
,
()
=>
{
const
noteId
=
'
dummy-note-id
'
;
let
wrapper
;
let
wrapper
;
let
convertToDiscussion
;
beforeEach
(()
=>
{
beforeEach
(()
=>
{
const
localVue
=
createLocalVue
();
const
localVue
=
createLocalVue
();
convertToDiscussion
=
jasmine
.
createSpy
(
'
convertToDiscussion
'
);
localVue
.
use
(
Vuex
);
localVue
.
use
(
Vuex
);
const
store
=
new
Vuex
.
Store
({
actions
:
{
convertToDiscussion
,
},
});
wrapper
=
mount
(
ReplyButton
,
{
wrapper
=
mount
(
ReplyButton
,
{
propsData
:
{
noteId
,
},
store
,
sync
:
false
,
sync
:
false
,
localVue
,
localVue
,
});
});
...
@@ -33,14 +20,13 @@ describe('ReplyButton', () => {
...
@@ -33,14 +20,13 @@ describe('ReplyButton', () => {
wrapper
.
destroy
();
wrapper
.
destroy
();
});
});
it
(
'
dispatches convertToDiscussion with note ID
on click
'
,
()
=>
{
it
(
'
emits startReplying
on click
'
,
()
=>
{
const
button
=
wrapper
.
find
({
ref
:
'
button
'
});
const
button
=
wrapper
.
find
({
ref
:
'
button
'
});
button
.
trigger
(
'
click
'
);
button
.
trigger
(
'
click
'
);
expect
(
convertToDiscussion
).
toHaveBeenCalledTimes
(
1
);
expect
(
wrapper
.
emitted
()).
toEqual
({
const
[,
payload
]
=
convertToDiscussion
.
calls
.
argsFor
(
0
);
startReplying
:
[[]],
});
expect
(
payload
).
toBe
(
noteId
);
});
});
});
});
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