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
9e4164d4
Commit
9e4164d4
authored
Aug 03, 2017
by
Filipa Lacerda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Keep the replies when the user leaves the page
parent
b5b562a3
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
45 additions
and
21 deletions
+45
-21
app/assets/javascripts/autosave.js
app/assets/javascripts/autosave.js
+5
-0
app/assets/javascripts/notes/components/issue_comment_form.vue
...ssets/javascripts/notes/components/issue_comment_form.vue
+8
-5
app/assets/javascripts/notes/components/issue_discussion.vue
app/assets/javascripts/notes/components/issue_discussion.vue
+15
-1
app/assets/javascripts/notes/components/issue_note.vue
app/assets/javascripts/notes/components/issue_note.vue
+0
-1
app/assets/javascripts/notes/components/issue_note_body.vue
app/assets/javascripts/notes/components/issue_note_body.vue
+11
-0
app/assets/javascripts/notes/components/issue_notes_app.vue
app/assets/javascripts/notes/components/issue_notes_app.vue
+5
-13
app/controllers/concerns/notes_actions.rb
app/controllers/concerns/notes_actions.rb
+1
-1
No files found.
app/assets/javascripts/autosave.js
View file @
9e4164d4
...
...
@@ -2,6 +2,11 @@
import
AccessorUtilities
from
'
./lib/utils/accessor
'
;
window
.
Autosave
=
(
function
()
{
/**
*
* @param {*} field the textarea
* @param {Array} key Array with: ['Note', type, id, ]
*/
function
Autosave
(
field
,
key
)
{
this
.
field
=
field
;
this
.
isLocalStorageAvailable
=
AccessorUtilities
.
isLocalStorageAccessSafe
();
...
...
app/assets/javascripts/notes/components/issue_comment_form.vue
View file @
9e4164d4
<
script
>
/* global Flash */
/* global Flash
, Autosave
*/
import
{
mapActions
,
mapGetters
}
from
'
vuex
'
;
import
userAvatarLink
from
'
../../vue_shared/components/user_avatar/user_avatar_link.vue
'
;
...
...
@@ -7,6 +7,7 @@
import
issueNoteSignedOutWidget
from
'
./issue_note_signed_out_widget.vue
'
;
import
eventHub
from
'
../event_hub
'
;
import
*
as
constants
from
'
../constants
'
;
import
'
../../autosave
'
;
export
default
{
data
()
{
...
...
@@ -153,15 +154,17 @@
}
}
},
initAutoSave
()
{
return
new
Autosave
(
$
(
this
.
$refs
.
textarea
),
[
'
Note
'
,
'
Issue
'
,
this
.
getIssueData
.
id
]);
},
},
mounted
()
{
eventHub
.
$on
(
'
issueStateChanged
'
,
(
isClosed
)
=>
{
// jQuery is needed here because it is a custom event being dispatched with jQuery.
$
(
document
).
on
(
'
issuable:change
'
,
(
e
,
isClosed
)
=>
{
this
.
issueState
=
isClosed
?
constants
.
CLOSED
:
constants
.
REOPENED
;
});
},
destroyed
()
{
eventHub
.
$off
(
'
issueStateChanged
'
);
this
.
initAutoSave
();
},
};
</
script
>
...
...
app/assets/javascripts/notes/components/issue_discussion.vue
View file @
9e4164d4
<
script
>
/* global Flash */
/* global Flash
, Autosave
*/
import
{
mapActions
,
mapGetters
}
from
'
vuex
'
;
import
{
SYSTEM_NOTE
}
from
'
../constants
'
;
import
issueNote
from
'
./issue_note.vue
'
;
...
...
@@ -11,6 +11,7 @@
import
issueNoteForm
from
'
./issue_note_form.vue
'
;
import
placeholderNote
from
'
./issue_placeholder_note.vue
'
;
import
placeholderSystemNote
from
'
./issue_placeholder_system_note.vue
'
;
import
'
../../autosave
'
;
export
default
{
props
:
{
...
...
@@ -107,6 +108,19 @@
})
.
catch
(()
=>
Flash
(
'
Something went wrong while adding your reply. Please try again.
'
));
},
initAutoSave
()
{
return
new
Autosave
(
$
(
this
.
$refs
.
noteForm
.
$refs
.
textarea
),
[
'
Note
'
,
'
Issue
'
,
this
.
note
.
id
]);
},
},
mounted
()
{
if
(
this
.
isReplying
)
{
this
.
initAutoSave
();
}
},
updated
()
{
if
(
this
.
isReplying
)
{
this
.
initAutoSave
();
}
},
};
</
script
>
...
...
app/assets/javascripts/notes/components/issue_note.vue
View file @
9e4164d4
...
...
@@ -39,7 +39,6 @@
return
{
'
is-editing
'
:
this
.
isEditing
,
'
disabled-content
'
:
this
.
isDeleting
,
//'js-my-note': this.author.id === this.currentUserId,
target
:
this
.
targetNoteHash
===
this
.
noteAnchorId
,
};
},
...
...
app/assets/javascripts/notes/components/issue_note_body.vue
View file @
9e4164d4
<
script
>
/* global Autosave */
import
issueNoteEditedText
from
'
./issue_note_edited_text.vue
'
;
import
issueNoteAwardsList
from
'
./issue_note_awards_list.vue
'
;
import
issueNoteForm
from
'
./issue_note_form.vue
'
;
import
TaskList
from
'
../../task_list
'
;
import
'
../../autosave
'
;
export
default
{
props
:
{
...
...
@@ -49,13 +51,22 @@
formCancelHandler
(
shouldConfirm
,
isDirty
)
{
this
.
$emit
(
'
cancelFormEdition
'
,
shouldConfirm
,
isDirty
);
},
initAutoSave
()
{
return
new
Autosave
(
$
(
this
.
$refs
.
noteForm
.
$refs
.
textarea
),
[
'
Note
'
,
'
Issue
'
,
this
.
note
.
id
]);
},
},
mounted
()
{
this
.
renderGFM
();
this
.
initTaskList
();
if
(
this
.
isEditing
)
{
this
.
initAutoSave
();
}
},
updated
()
{
this
.
initTaskList
();
if
(
this
.
isEditing
)
{
this
.
initAutoSave
();
}
},
};
</
script
>
...
...
app/assets/javascripts/notes/components/issue_notes_app.vue
View file @
9e4164d4
...
...
@@ -4,7 +4,6 @@
import
{
mapGetters
,
mapActions
}
from
'
vuex
'
;
import
store
from
'
../stores/
'
;
import
*
as
constants
from
'
../constants
'
;
import
eventHub
from
'
../event_hub
'
;
import
issueNote
from
'
./issue_note.vue
'
;
import
issueDiscussion
from
'
./issue_discussion.vue
'
;
import
issueSystemNote
from
'
./issue_system_note.vue
'
;
...
...
@@ -96,17 +95,6 @@
this
.
poll
();
},
bindEventHubListeners
()
{
this
.
$el
.
parentElement
.
addEventListener
(
'
toggleAward
'
,
(
event
)
=>
{
const
{
awardName
,
noteId
}
=
event
.
detail
;
this
.
actionToggleAward
({
awardName
,
noteId
});
});
// JQuery is needed here because it is a custom event being dispatched with jQuery.
$
(
document
).
on
(
'
issuable:change
'
,
(
e
,
isClosed
)
=>
{
eventHub
.
$emit
(
'
issueStateChanged
'
,
isClosed
);
});
},
checkLocationHash
()
{
const
hash
=
gl
.
utils
.
getLocationHash
();
const
$el
=
$
(
`#
${
hash
}
`
);
...
...
@@ -125,7 +113,11 @@
mounted
()
{
this
.
fetchNotes
();
this
.
initPolling
();
this
.
bindEventHubListeners
();
this
.
$el
.
parentElement
.
addEventListener
(
'
toggleAward
'
,
(
event
)
=>
{
const
{
awardName
,
noteId
}
=
event
.
detail
;
this
.
actionToggleAward
({
awardName
,
noteId
});
});
},
};
</
script
>
...
...
app/controllers/concerns/notes_actions.rb
View file @
9e4164d4
...
...
@@ -179,7 +179,7 @@ module NotesActions
def
set_polling_interval_header
return
unless
noteable
.
is_a?
(
Issue
)
Gitlab
::
PollingInterval
.
set_header
(
response
,
interval:
3
_000
)
Gitlab
::
PollingInterval
.
set_header
(
response
,
interval:
6
_000
)
end
def
noteable
...
...
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