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
397686df
Commit
397686df
authored
Jul 18, 2017
by
Fatih Acet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
IssueNotesRefactor: Implement note edit conflict warning.
parent
3c946b93
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
38 additions
and
5 deletions
+38
-5
app/assets/javascripts/notes/components/issue_note_actions.vue
...ssets/javascripts/notes/components/issue_note_actions.vue
+2
-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/components/issue_note_form.vue
app/assets/javascripts/notes/components/issue_note_form.vue
+29
-2
No files found.
app/assets/javascripts/notes/components/issue_note_actions.vue
View file @
397686df
...
...
@@ -111,7 +111,7 @@ export default {
<button
@
click=
"editHandler"
type=
"button"
class=
"btn btn-transparent"
>
class=
"btn btn-transparent
js-note-edit
"
>
Edit comment
</button>
</li>
...
...
@@ -126,7 +126,7 @@ export default {
<a
v-if=
"canEdit"
@
click.prevent=
"deleteHandler"
class=
"js-note-delete"
class=
"js-note-delete
js-note-delete
"
href=
"#"
>
<span
class=
"text-danger"
>
Delete comment
...
...
app/assets/javascripts/notes/components/issue_note_body.vue
View file @
397686df
...
...
@@ -28,6 +28,11 @@ export default {
required
:
true
,
},
},
computed
:
{
noteBody
()
{
return
this
.
note
.
note
;
},
},
components
:
{
IssueNoteEditedText
,
IssueNoteAwardsList
,
...
...
@@ -75,7 +80,8 @@ export default {
ref=
"noteForm"
:updateHandler=
"handleFormUpdate"
:cancelHandler=
"formCancelHandler"
:noteBody=
"note.note"
/>
:noteBody=
"noteBody"
:noteId=
"note.id"
/>
<textarea
v-if=
"canEdit"
v-model=
"note.note"
...
...
app/assets/javascripts/notes/components/issue_note_form.vue
View file @
397686df
...
...
@@ -9,6 +9,10 @@ export default {
required
:
false
,
default
:
''
,
},
noteId
:
{
type
:
Number
,
required
:
false
,
},
updateHandler
:
{
type
:
Function
,
required
:
true
,
...
...
@@ -29,8 +33,18 @@ export default {
note
:
this
.
noteBody
,
markdownPreviewUrl
:
''
,
markdownDocsUrl
:
''
,
conflictWhileEditing
:
false
,
};
},
watch
:
{
noteBody
()
{
if
(
this
.
note
===
this
.
initialNote
)
{
this
.
note
=
this
.
noteBody
;
}
else
{
this
.
conflictWhileEditing
=
true
;
}
},
},
components
:
{
MarkdownField
,
},
...
...
@@ -57,6 +71,9 @@ export default {
isDirty
()
{
return
this
.
initialNote
!==
this
.
note
;
},
noteHash
()
{
return
`#note_
${
this
.
noteId
}
`
;
},
},
mounted
()
{
const
issuableDataEl
=
document
.
getElementById
(
'
js-issuable-app-initial-data
'
);
...
...
@@ -72,6 +89,16 @@ export default {
<
template
>
<div
class=
"note-edit-form"
>
<div
v-if=
"conflictWhileEditing"
class=
"js-conflict-edit-warning alert alert-danger"
>
This comment has changed since you started editing, please review the
<a
:href=
"noteHash"
target=
"_blank"
rel=
"noopener noreferrer"
>
updated comment
</a>
to ensure information is not lost.
</div>
<form
class=
"edit-note common-note-form"
>
<markdown-field
:markdown-preview-url=
"markdownPreviewUrl"
...
...
@@ -79,7 +106,7 @@ export default {
:addSpacingClasses=
"false"
>
<textarea
id=
"note-body"
class=
"note-textarea js-gfm-input js-autosize markdown-area"
class=
"note-textarea js-gfm-input js-autosize markdown-area
js-note-text
"
data-supports-slash-commands=
"true"
data-supports-quick-actions=
"true"
aria-label=
"Description"
...
...
@@ -101,7 +128,7 @@ export default {
</button>
<button
@
click=
"cancelHandler()"
class=
"btn btn-nr btn-cancel"
class=
"btn btn-nr btn-cancel
note-edit-cancel
"
type=
"button"
>
Cancel
</button>
...
...
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