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
e868d09d
Commit
e868d09d
authored
Jul 12, 2018
by
Fatih Acet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use built-in autosave mixin in diff line note form.
parent
1f2d2511
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
7 deletions
+5
-7
app/assets/javascripts/diffs/components/diff_line_note_form.vue
...sets/javascripts/diffs/components/diff_line_note_form.vue
+5
-7
No files found.
app/assets/javascripts/diffs/components/diff_line_note_form.vue
View file @
e868d09d
...
@@ -5,13 +5,14 @@ import createFlash from '~/flash';
...
@@ -5,13 +5,14 @@ import createFlash from '~/flash';
import
{
s__
}
from
'
~/locale
'
;
import
{
s__
}
from
'
~/locale
'
;
import
noteForm
from
'
../../notes/components/note_form.vue
'
;
import
noteForm
from
'
../../notes/components/note_form.vue
'
;
import
{
getNoteFormData
}
from
'
../store/utils
'
;
import
{
getNoteFormData
}
from
'
../store/utils
'
;
import
Autosave
from
'
../..
/autosave
'
;
import
autosave
from
'
../../notes/mixins
/autosave
'
;
import
{
DIFF_NOTE_TYPE
,
NOTE_TYPE
}
from
'
../constants
'
;
import
{
DIFF_NOTE_TYPE
,
NOTE_TYPE
}
from
'
../constants
'
;
export
default
{
export
default
{
components
:
{
components
:
{
noteForm
,
noteForm
,
},
},
mixins
:
[
autosave
],
props
:
{
props
:
{
diffFileHash
:
{
diffFileHash
:
{
type
:
String
,
type
:
String
,
...
@@ -41,28 +42,25 @@ export default {
...
@@ -41,28 +42,25 @@ export default {
},
},
mounted
()
{
mounted
()
{
if
(
this
.
isLoggedIn
)
{
if
(
this
.
isLoggedIn
)
{
const
noteableData
=
this
.
getN
oteableData
;
const
noteableData
=
this
.
n
oteableData
;
const
keys
=
[
const
keys
=
[
NOTE_TYPE
,
this
.
noteableType
,
noteableData
.
id
,
noteableData
.
diff_head_sha
,
noteableData
.
diff_head_sha
,
DIFF_NOTE_TYPE
,
DIFF_NOTE_TYPE
,
noteableData
.
source_project_id
,
noteableData
.
source_project_id
,
this
.
line
.
lineCode
,
this
.
line
.
lineCode
,
];
];
this
.
autosave
=
new
Autosave
(
$
(
this
.
$refs
.
noteForm
.
$refs
.
textarea
)
,
keys
);
this
.
initAutoSave
(
noteableData
,
keys
);
}
}
},
},
methods
:
{
methods
:
{
...
mapActions
(
'
diffs
'
,
[
'
cancelCommentForm
'
]),
...
mapActions
(
'
diffs
'
,
[
'
cancelCommentForm
'
]),
...
mapActions
([
'
saveNote
'
,
'
refetchDiscussionById
'
]),
...
mapActions
([
'
saveNote
'
,
'
refetchDiscussionById
'
]),
handleCancelCommentForm
()
{
handleCancelCommentForm
()
{
this
.
autosave
.
reset
();
this
.
cancelCommentForm
({
this
.
cancelCommentForm
({
lineCode
:
this
.
line
.
lineCode
,
lineCode
:
this
.
line
.
lineCode
,
});
});
this
.
resetAutoSave
();
},
},
handleSaveNote
(
note
)
{
handleSaveNote
(
note
)
{
const
selectedDiffFile
=
this
.
getDiffFileByHash
(
this
.
diffFileHash
);
const
selectedDiffFile
=
this
.
getDiffFileByHash
(
this
.
diffFileHash
);
...
...
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