diff options
Diffstat (limited to 'app/assets/javascripts/notes/stores/getters.js')
-rw-r--r-- | app/assets/javascripts/notes/stores/getters.js | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/app/assets/javascripts/notes/stores/getters.js b/app/assets/javascripts/notes/stores/getters.js index 5ad7a811726..f6373f24b74 100644 --- a/app/assets/javascripts/notes/stores/getters.js +++ b/app/assets/javascripts/notes/stores/getters.js @@ -2,6 +2,7 @@ import { flattenDeep, clone } from 'lodash'; import { match } from '~/diffs/utils/diff_file'; import { badgeState } from '~/issuable/components/status_box.vue'; import { isInMRPage } from '~/lib/utils/common_utils'; +import { doesHashExistInUrl } from '~/lib/utils/url_utility'; import * as constants from '../constants'; import { collapseSystemNotes } from './collapse_utils'; @@ -314,3 +315,22 @@ export const getSuggestionsFilePaths = (state) => () => return acc; }, []); + +export const getFetchDiscussionsConfig = (state, getters) => { + const defaultConfig = { path: getters.getNotesDataByProp('discussionsPath') }; + + const currentFilter = + getters.getNotesDataByProp('notesFilter') || constants.DISCUSSION_FILTERS_DEFAULT_VALUE; + + if ( + doesHashExistInUrl(constants.NOTE_UNDERSCORE) && + currentFilter !== constants.DISCUSSION_FILTERS_DEFAULT_VALUE + ) { + return { + ...defaultConfig, + filter: constants.DISCUSSION_FILTERS_DEFAULT_VALUE, + persistFilter: false, + }; + } + return defaultConfig; +}; |