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
998299e2
Commit
998299e2
authored
Jun 22, 2017
by
Fatih Acet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
IssueNotesRefactor: Implement note edit.
parent
092d4ca6
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
47 additions
and
3 deletions
+47
-3
app/assets/javascripts/notes/components/issue_note.vue
app/assets/javascripts/notes/components/issue_note.vue
+17
-2
app/assets/javascripts/notes/components/issue_note_body.vue
app/assets/javascripts/notes/components/issue_note_body.vue
+7
-1
app/assets/javascripts/notes/services/issue_notes_service.js
app/assets/javascripts/notes/services/issue_notes_service.js
+3
-0
app/assets/javascripts/notes/stores/issue_notes_store.js
app/assets/javascripts/notes/stores/issue_notes_store.js
+20
-0
No files found.
app/assets/javascripts/notes/components/issue_note.vue
View file @
998299e2
...
...
@@ -57,8 +57,23 @@ export default {
});
}
},
formUpdateHandler
()
{
// console.log('update requested', data);
formUpdateHandler
(
note
)
{
const
data
=
{
endpoint
:
`
${
this
.
note
.
path
}
?full_data=1`
,
note
:
{
target_type
:
'
issue
'
,
target_id
:
this
.
note
.
noteable_id
,
note
,
},
};
this
.
$store
.
dispatch
(
'
updateNote
'
,
data
)
.
then
(()
=>
{
this
.
isEditing
=
false
;
})
.
catch
(()
=>
{
new
Flash
(
'
Something went wrong while editing your comment. Please try again.
'
);
// eslint-disable-line
});
},
formCancelHandler
()
{
this
.
isEditing
=
false
;
...
...
app/assets/javascripts/notes/components/issue_note_body.vue
View file @
998299e2
...
...
@@ -32,6 +32,11 @@ export default {
renderGFM
()
{
$
(
this
.
$refs
[
'
note-body
'
]).
renderGFM
();
},
handleFormUpdate
()
{
this
.
formUpdateHandler
({
note
:
this
.
$refs
.
noteForm
.
note
,
});
},
},
mounted
()
{
this
.
renderGFM
();
...
...
@@ -48,7 +53,8 @@ export default {
class=
"note-text md"
></div>
<issue-note-form
v-if=
"isEditing"
:updateHandler=
"formUpdateHandler"
ref=
"noteForm"
:updateHandler=
"handleFormUpdate"
:cancelHandler=
"formCancelHandler"
:noteBody=
"note.note"
/>
<issue-note-edited-text
...
...
app/assets/javascripts/notes/services/issue_notes_service.js
View file @
998299e2
...
...
@@ -13,4 +13,7 @@ export default {
replyToDiscussion
(
endpoint
,
data
)
{
return
Vue
.
http
.
post
(
endpoint
,
data
,
{
emulateJSON
:
true
});
},
updateNote
(
endpoint
,
data
)
{
return
Vue
.
http
.
put
(
endpoint
,
data
,
{
emulateJSON
:
true
});
},
};
app/assets/javascripts/notes/stores/issue_notes_store.js
View file @
998299e2
...
...
@@ -42,6 +42,16 @@ const mutations = {
noteObj
.
notes
.
push
(
note
);
},
updateNote
(
storeState
,
note
)
{
const
noteObj
=
findNoteObjectById
(
storeState
.
notes
,
note
.
discussion_id
);
if
(
noteObj
.
individual_note
)
{
noteObj
.
notes
.
splice
(
0
,
1
,
note
);
}
else
{
const
comment
=
findNoteObjectById
(
noteObj
.
notes
,
note
.
id
);
noteObj
.
notes
.
splice
(
noteObj
.
notes
.
indexOf
(
comment
),
1
,
note
);
}
},
};
const
actions
=
{
...
...
@@ -70,6 +80,16 @@ const actions = {
context
.
commit
(
'
addNewReplyToDiscussion
'
,
res
);
});
},
updateNote
(
context
,
data
)
{
const
{
endpoint
,
note
}
=
data
;
return
service
.
updateNote
(
endpoint
,
note
)
.
then
(
res
=>
res
.
json
())
.
then
((
res
)
=>
{
context
.
commit
(
'
updateNote
'
,
res
);
});
},
};
export
default
{
...
...
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