diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-07 18:09:19 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-07 18:09:19 +0000 |
commit | 3290d46655f07d7ae3dca788d6df9f326972ffd8 (patch) | |
tree | 0d24713e1592cdd3583257f14a52d46a22539ed1 /app/assets/javascripts/notes | |
parent | c6b3ec3f56fa32a0e0ed3de0d0878d25f1adaddf (diff) | |
download | gitlab-ce-3290d46655f07d7ae3dca788d6df9f326972ffd8.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/notes')
-rw-r--r-- | app/assets/javascripts/notes/components/sort_discussion.vue | 13 |
1 files changed, 12 insertions, 1 deletions
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" /> |