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
53e23a29
Commit
53e23a29
authored
Mar 04, 2019
by
Winnie Hellmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Pass autosaveKey from NoteableDiscussion to NoteForm
parent
93c27c3b
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
16 additions
and
0 deletions
+16
-0
app/assets/javascripts/lib/utils/autosave.js
app/assets/javascripts/lib/utils/autosave.js
+5
-0
app/assets/javascripts/notes/components/noteable_discussion.vue
...sets/javascripts/notes/components/noteable_discussion.vue
+5
-0
changelogs/unreleased/winh-toggle-comment-draft.yml
changelogs/unreleased/winh-toggle-comment-draft.yml
+5
-0
spec/javascripts/notes/components/noteable_discussion_spec.js
.../javascripts/notes/components/noteable_discussion_spec.js
+1
-0
No files found.
app/assets/javascripts/lib/utils/autosave.js
View file @
53e23a29
import
{
capitalizeFirstCharacter
}
from
'
~/lib/utils/text_utility
'
;
export
const
clearDraft
=
autosaveKey
=>
{
export
const
clearDraft
=
autosaveKey
=>
{
try
{
try
{
window
.
localStorage
.
removeItem
(
`autosave/
${
autosaveKey
}
`
);
window
.
localStorage
.
removeItem
(
`autosave/
${
autosaveKey
}
`
);
...
@@ -25,3 +27,6 @@ export const updateDraft = (autosaveKey, text) => {
...
@@ -25,3 +27,6 @@ export const updateDraft = (autosaveKey, text) => {
console
.
error
(
e
);
console
.
error
(
e
);
}
}
};
};
export
const
getDiscussionReplyKey
=
(
noteableType
,
discussionId
)
=>
[
'
Note
'
,
capitalizeFirstCharacter
(
noteableType
),
discussionId
,
'
Reply
'
].
join
(
'
/
'
);
app/assets/javascripts/notes/components/noteable_discussion.vue
View file @
53e23a29
...
@@ -4,6 +4,7 @@ import { mapActions, mapGetters } from 'vuex';
...
@@ -4,6 +4,7 @@ import { mapActions, mapGetters } from 'vuex';
import
{
GlTooltipDirective
}
from
'
@gitlab/ui
'
;
import
{
GlTooltipDirective
}
from
'
@gitlab/ui
'
;
import
{
truncateSha
}
from
'
~/lib/utils/text_utility
'
;
import
{
truncateSha
}
from
'
~/lib/utils/text_utility
'
;
import
{
s__
,
__
,
sprintf
}
from
'
~/locale
'
;
import
{
s__
,
__
,
sprintf
}
from
'
~/locale
'
;
import
{
getDiscussionReplyKey
}
from
'
~/lib/utils/autosave
'
;
import
systemNote
from
'
~/vue_shared/components/notes/system_note.vue
'
;
import
systemNote
from
'
~/vue_shared/components/notes/system_note.vue
'
;
import
icon
from
'
~/vue_shared/components/icon.vue
'
;
import
icon
from
'
~/vue_shared/components/icon.vue
'
;
import
diffLineNoteFormMixin
from
'
ee_else_ce/notes/mixins/diff_line_note_form
'
;
import
diffLineNoteFormMixin
from
'
ee_else_ce/notes/mixins/diff_line_note_form
'
;
...
@@ -108,6 +109,9 @@ export default {
...
@@ -108,6 +109,9 @@ export default {
author
()
{
author
()
{
return
this
.
firstNote
.
author
;
return
this
.
firstNote
.
author
;
},
},
autosaveKey
()
{
return
getDiscussionReplyKey
(
this
.
firstNote
.
noteable_type
,
this
.
discussion
.
id
);
},
canReply
()
{
canReply
()
{
return
this
.
getNoteableData
.
current_user
.
can_create_note
;
return
this
.
getNoteableData
.
current_user
.
can_create_note
;
},
},
...
@@ -512,6 +516,7 @@ Please check your network connection and try again.`;
...
@@ -512,6 +516,7 @@ Please check your network connection and try again.`;
:is-editing=
"false"
:is-editing=
"false"
:line=
"diffLine"
:line=
"diffLine"
save-button-title=
"Comment"
save-button-title=
"Comment"
:autosave-key=
"autosaveKey"
@
handleFormUpdateAddToReview=
"addReplyToReview"
@
handleFormUpdateAddToReview=
"addReplyToReview"
@
handleFormUpdate=
"saveReply"
@
handleFormUpdate=
"saveReply"
@
cancelForm=
"cancelReplyForm"
@
cancelForm=
"cancelReplyForm"
...
...
changelogs/unreleased/winh-toggle-comment-draft.yml
0 → 100644
View file @
53e23a29
---
title
:
Display draft when toggling replies
merge_request
:
25563
author
:
type
:
fixed
spec/javascripts/notes/components/noteable_discussion_spec.js
View file @
53e23a29
...
@@ -84,6 +84,7 @@ describe('noteable_discussion component', () => {
...
@@ -84,6 +84,7 @@ describe('noteable_discussion component', () => {
expect
(
noteFormProps
.
isEditing
).
toBe
(
false
);
expect
(
noteFormProps
.
isEditing
).
toBe
(
false
);
expect
(
noteFormProps
.
line
).
toBe
(
null
);
expect
(
noteFormProps
.
line
).
toBe
(
null
);
expect
(
noteFormProps
.
saveButtonTitle
).
toBe
(
'
Comment
'
);
expect
(
noteFormProps
.
saveButtonTitle
).
toBe
(
'
Comment
'
);
expect
(
noteFormProps
.
autosaveKey
).
toBe
(
`Note/Issue/
${
discussionMock
.
id
}
/Reply`
);
})
})
.
then
(
done
)
.
then
(
done
)
.
catch
(
done
.
fail
);
.
catch
(
done
.
fail
);
...
...
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