From 893402d477436d36b48c2fd0244576a0d16e9425 Mon Sep 17 00:00:00 2001 From: kushalpandya Date: Fri, 13 Oct 2017 19:33:18 +0530 Subject: [PATCH] Preserve `archived` param only when sort order is changed --- app/assets/javascripts/groups/groups_filterable_list.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/assets/javascripts/groups/groups_filterable_list.js b/app/assets/javascripts/groups/groups_filterable_list.js index 396e57c5802..2db233b09da 100644 --- a/app/assets/javascripts/groups/groups_filterable_list.js +++ b/app/assets/javascripts/groups/groups_filterable_list.js @@ -64,11 +64,11 @@ export default class GroupFilterableList extends FilterableList { // Get type of option selected from dropdown const currentTargetClassList = e.currentTarget.parentElement.classList; const isOptionFilterBySort = currentTargetClassList.contains('js-filter-sort-order'); + const isOptionFilterByArchivedProjects = currentTargetClassList.contains('js-filter-archived-projects'); // Get option query param, also preserve currently applied query param - const isOptionFilterByArchivedProjects = currentTargetClassList.contains('js-filter-archived-projects'); - const sortParam = getParameterByName('sort', e.currentTarget.href) || getParameterByName('sort', window.location.href); - const archivedParam = getParameterByName('archived', e.currentTarget.href) || getParameterByName('archived', window.location.href); + const sortParam = getParameterByName('sort', isOptionFilterBySort ? e.currentTarget.href : window.location.href); + const archivedParam = getParameterByName('archived', isOptionFilterByArchivedProjects ? e.currentTarget.href : window.location.href); if (sortParam) { queryData.sort = sortParam;