From 3290d46655f07d7ae3dca788d6df9f326972ffd8 Mon Sep 17 00:00:00 2001
From: GitLab Bot <gitlab-bot@gitlab.com>
Date: Tue, 7 Apr 2020 18:09:19 +0000
Subject: Add latest changes from gitlab-org/gitlab@master

---
 app/assets/javascripts/notes/components/sort_discussion.vue | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

(limited to 'app/assets/javascripts/notes/components/sort_discussion.vue')

diff --git a/app/assets/javascripts/notes/components/sort_discussion.vue b/app/assets/javascripts/notes/components/sort_discussion.vue
index 3f82ddde3ef..4a7543819eb 100644
--- a/app/assets/javascripts/notes/components/sort_discussion.vue
+++ b/app/assets/javascripts/notes/components/sort_discussion.vue
@@ -1,7 +1,9 @@
+gs
 <script>
 import { GlIcon } from '@gitlab/ui';
 import { mapActions, mapGetters } from 'vuex';
 import { __ } from '~/locale';
+import LocalStorageSync from '~/vue_shared/components/local_storage_sync.vue';
 import Tracking from '~/tracking';
 import { ASC, DESC } from '../constants';
 
@@ -14,16 +16,20 @@ export default {
   SORT_OPTIONS,
   components: {
     GlIcon,
+    LocalStorageSync,
   },
   mixins: [Tracking.mixin()],
   computed: {
-    ...mapGetters(['sortDirection']),
+    ...mapGetters(['sortDirection', 'noteableType']),
     selectedOption() {
       return SORT_OPTIONS.find(({ key }) => this.sortDirection === key);
     },
     dropdownText() {
       return this.selectedOption.text;
     },
+    storageKey() {
+      return `sort_direction_${this.noteableType.toLowerCase()}`;
+    },
   },
   methods: {
     ...mapActions(['setDiscussionSortDirection']),
@@ -44,6 +50,11 @@ export default {
 
 <template>
   <div class="mr-2 d-inline-block align-bottom full-width-mobile">
+    <local-storage-sync
+      :value="sortDirection"
+      :storage-key="storageKey"
+      @input="setDiscussionSortDirection"
+    />
     <button class="btn btn-sm js-dropdown-text" data-toggle="dropdown" aria-expanded="false">
       {{ dropdownText }}
       <gl-icon name="chevron-down" />
-- 
cgit v1.2.3

