From 5333cb6c7c960aac58af40c898c87d050d829383 Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Mon, 18 Nov 2019 09:06:43 +0000 Subject: Add latest changes from gitlab-org/gitlab@master --- app/assets/javascripts/notes/components/notes_app.vue | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'app/assets/javascripts/notes/components') diff --git a/app/assets/javascripts/notes/components/notes_app.vue b/app/assets/javascripts/notes/components/notes_app.vue index c6c97489e5e..9d1de4ef8a0 100644 --- a/app/assets/javascripts/notes/components/notes_app.vue +++ b/app/assets/javascripts/notes/components/notes_app.vue @@ -122,6 +122,8 @@ export default { this.toggleAward({ awardName, noteId }); }); } + + window.addEventListener('hashchange', this.handleHashChanged); }, updated() { this.$nextTick(() => { @@ -131,6 +133,7 @@ export default { }, beforeDestroy() { this.stopPolling(); + window.removeEventListener('hashchange', this.handleHashChanged); }, methods: { ...mapActions([ @@ -138,7 +141,6 @@ export default { 'fetchDiscussions', 'poll', 'toggleAward', - 'scrollToNoteIfNeeded', 'setNotesData', 'setNoteableData', 'setUserData', @@ -151,6 +153,13 @@ export default { 'convertToDiscussion', 'stopPolling', ]), + handleHashChanged() { + const noteId = this.checkLocationHash(); + + if (noteId) { + this.setTargetNoteHash(getLocationHash()); + } + }, fetchNotes() { if (this.isFetching) return null; @@ -194,6 +203,8 @@ export default { this.expandDiscussion({ discussionId: discussion.id }); } } + + return noteId; }, startReplying(discussionId) { return this.convertToDiscussion(discussionId) -- cgit v1.2.1