Skip to content

Commit

Permalink
EPMRPP-95440 || Code Review fix - 1
Browse files Browse the repository at this point in the history
  • Loading branch information
BlazarQSO committed Sep 23, 2024
1 parent 15f3b26 commit a95acf7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
3 changes: 2 additions & 1 deletion app/src/common/constants/reservedFilterIds.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@
export const ALL = 'all';
export const LATEST = 'latest';
export const NEW_FILTER_PREFIX = 'New_filter';
export const CUSTOM_FILTER = '-1';
export const CUSTOM_FILTER_ID = '-1';
export const CUSTOM_FILTER = 'Custom filter';
12 changes: 8 additions & 4 deletions app/src/controllers/filter/sagas.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,11 @@ import { FETCH_PROJECT_PREFERENCES_SUCCESS } from 'controllers/project/constants
import { launchDistinctSelector } from 'controllers/launch/selectors';
import { fetchLaunchesAction } from 'controllers/launch/actionCreators';
import { omit } from 'common/utils/omit';
import { NEW_FILTER_PREFIX, CUSTOM_FILTER } from 'common/constants/reservedFilterIds';
import {
NEW_FILTER_PREFIX,
CUSTOM_FILTER,
CUSTOM_FILTER_ID,
} from 'common/constants/reservedFilterIds';
import { redirect } from 'redux-first-router';
import {
NAMESPACE,
Expand Down Expand Up @@ -138,20 +142,20 @@ function* createFilter({ payload = {}, meta = {} }) {

const filterName = hasFilterPermissions
? `${NEW_FILTER_PREFIX} ${-(lastNewFilterId - 1)}`
: 'Custom filter';
: CUSTOM_FILTER;

const newFilter = {
...DEFAULT_FILTER,
...filter,
id: hasFilterPermissions ? lastNewFilterId - 1 : CUSTOM_FILTER,
id: hasFilterPermissions ? lastNewFilterId - 1 : CUSTOM_FILTER_ID,
name: filter.name ? `${COPY_PREFIX} ${filter.name}` : filterName,
owner: userId,
};
yield put(addFilterAction(newFilter));
yield put(changeActiveFilterAction(newFilter.id, meta));

if (isRemoveCustomFilter) {
yield put(removeLaunchesFilterAction(CUSTOM_FILTER));
yield put(removeLaunchesFilterAction(CUSTOM_FILTER_ID));
}
}

Expand Down

0 comments on commit a95acf7

Please sign in to comment.