From 6b383856ede3954226bb9e17f8b0b2b62a1b91c1 Mon Sep 17 00:00:00 2001 From: Lautaro Petaccio Date: Mon, 22 Apr 2024 14:09:45 -0300 Subject: [PATCH] fix: Remove exotic rarity FF --- .../RightPanel/RightPanel.container.ts | 3 +- .../RightPanel/RightPanel.types.ts | 2 - .../CreateSingleItemModal.container.ts | 4 +- .../CreateSingleItemModal.types.ts | 2 +- .../PublishWizardCollectionModal.container.ts | 4 +- src/modules/features/selectors.ts | 8 --- src/modules/item/selectors.spec.ts | 55 ------------------- src/modules/item/selectors.ts | 10 +--- 8 files changed, 6 insertions(+), 82 deletions(-) diff --git a/src/components/ItemEditorPage/RightPanel/RightPanel.container.ts b/src/components/ItemEditorPage/RightPanel/RightPanel.container.ts index ebcf621bf..3d60f887a 100644 --- a/src/components/ItemEditorPage/RightPanel/RightPanel.container.ts +++ b/src/components/ItemEditorPage/RightPanel/RightPanel.container.ts @@ -8,7 +8,7 @@ import { isOwner } from 'modules/item/utils' import { getSelectedItemId } from 'modules/location/selectors' import { getCollection, hasViewAndEditRights } from 'modules/collection/selectors' import { isWalletCommitteeMember } from 'modules/committee/selectors' -import { getIsCampaignEnabled, getIsExoticRarityEnabled, getIsVrmOptOutEnabled } from 'modules/features/selectors' +import { getIsCampaignEnabled, getIsVrmOptOutEnabled } from 'modules/features/selectors' import { MapStateProps, MapDispatchProps, MapDispatch } from './RightPanel.types' import RightPanel from './RightPanel' @@ -35,7 +35,6 @@ const mapState = (state: RootState): MapStateProps => { isDownloading: isDownloading(state), isCommitteeMember: isWalletCommitteeMember(state), isCampaignEnabled: getIsCampaignEnabled(state), - isExoticRarityEnabled: getIsExoticRarityEnabled(state), isVrmOptOutEnabled: getIsVrmOptOutEnabled(state) } } diff --git a/src/components/ItemEditorPage/RightPanel/RightPanel.types.ts b/src/components/ItemEditorPage/RightPanel/RightPanel.types.ts index 6fc7577d0..5211c2b01 100644 --- a/src/components/ItemEditorPage/RightPanel/RightPanel.types.ts +++ b/src/components/ItemEditorPage/RightPanel/RightPanel.types.ts @@ -26,7 +26,6 @@ export type Props = { isDownloading: boolean isCommitteeMember: boolean isCampaignEnabled: boolean - isExoticRarityEnabled: boolean isVrmOptOutEnabled: boolean onSaveItem: typeof saveItemRequest onDeleteItem: typeof deleteItemRequest @@ -60,7 +59,6 @@ export type MapStateProps = Pick< | 'isCommitteeMember' | 'canEditSelectedItem' | 'isCampaignEnabled' - | 'isExoticRarityEnabled' | 'isVrmOptOutEnabled' > export type MapDispatchProps = Pick diff --git a/src/components/Modals/CreateSingleItemModal/CreateSingleItemModal.container.ts b/src/components/Modals/CreateSingleItemModal/CreateSingleItemModal.container.ts index bb81c033f..36f623ef3 100644 --- a/src/components/Modals/CreateSingleItemModal/CreateSingleItemModal.container.ts +++ b/src/components/Modals/CreateSingleItemModal/CreateSingleItemModal.container.ts @@ -6,7 +6,6 @@ import { getCollection } from 'modules/collection/selectors' import { Collection } from 'modules/collection/types' import { saveItemRequest, SAVE_ITEM_REQUEST } from 'modules/item/actions' import { getLoading, getError, getStatusByItemId } from 'modules/item/selectors' -import { getIsExoticRarityEnabled } from 'modules/features/selectors' import { MapStateProps, MapDispatchProps, MapDispatch, OwnProps } from './CreateSingleItemModal.types' import CreateSingleItemModal from './CreateSingleItemModal' @@ -20,8 +19,7 @@ const mapState = (state: RootState, ownProps: OwnProps): MapStateProps => { address: getAddress(state), error: getError(state), itemStatus, - isLoading: isLoadingType(getLoading(state), SAVE_ITEM_REQUEST), - isExoticRarityEnabled: getIsExoticRarityEnabled(state) + isLoading: isLoadingType(getLoading(state), SAVE_ITEM_REQUEST) } } diff --git a/src/components/Modals/CreateSingleItemModal/CreateSingleItemModal.types.ts b/src/components/Modals/CreateSingleItemModal/CreateSingleItemModal.types.ts index af352615e..7afe84324 100644 --- a/src/components/Modals/CreateSingleItemModal/CreateSingleItemModal.types.ts +++ b/src/components/Modals/CreateSingleItemModal/CreateSingleItemModal.types.ts @@ -103,6 +103,6 @@ export type AcceptedFileProps = Pick< | 'blockVrmExport' > export type OwnProps = Pick -export type MapStateProps = Pick +export type MapStateProps = Pick export type MapDispatchProps = Pick export type MapDispatch = Dispatch diff --git a/src/components/Modals/PublishWizardCollectionModal/PublishWizardCollectionModal.container.ts b/src/components/Modals/PublishWizardCollectionModal/PublishWizardCollectionModal.container.ts index e2276b565..8c7419973 100644 --- a/src/components/Modals/PublishWizardCollectionModal/PublishWizardCollectionModal.container.ts +++ b/src/components/Modals/PublishWizardCollectionModal/PublishWizardCollectionModal.container.ts @@ -8,7 +8,7 @@ import { getUnsyncedCollectionError, getError as getCollectionError } from 'modules/collection/selectors' -import { getLoading as getItemLoading, getCollectionItems, getError as getItemError, getFilteredRarities } from 'modules/item/selectors' +import { getLoading as getItemLoading, getCollectionItems, getError as getItemError, getRarities } from 'modules/item/selectors' import { publishCollectionRequest, PUBLISH_COLLECTION_REQUEST } from 'modules/collection/actions' import { CREATE_COLLECTION_FORUM_POST_REQUEST } from 'modules/forum/actions' import { fetchRaritiesRequest, FETCH_RARITIES_REQUEST, FETCH_ITEMS_REQUEST } from 'modules/item/actions' @@ -29,7 +29,7 @@ const mapState = (state: RootState, ownProps: OwnProps): MapStateProps => { wallet: getWallet(state)!, collection, items: getCollectionItems(state, collectionId), - rarities: getFilteredRarities(state), + rarities: getRarities(state), unsyncedCollectionError: getUnsyncedCollectionError(state), itemError: getItemError(state), collectionError: getCollectionError(state), diff --git a/src/modules/features/selectors.ts b/src/modules/features/selectors.ts index 6bb1ff044..97e194d43 100644 --- a/src/modules/features/selectors.ts +++ b/src/modules/features/selectors.ts @@ -46,14 +46,6 @@ export const getIsPublishCollectionsWertEnabled = (state: RootState) => { } } -export const getIsExoticRarityEnabled = (state: RootState) => { - try { - return getIsFeatureEnabled(state, ApplicationName.DAPPS, FeatureName.EXOTIC_RARITY) - } catch (e) { - return false - } -} - export const getIsVrmOptOutEnabled = (state: RootState) => { try { return getIsFeatureEnabled(state, ApplicationName.BUILDER, FeatureName.VRM_OPTOUT) diff --git a/src/modules/item/selectors.spec.ts b/src/modules/item/selectors.spec.ts index c84075ed2..6ebb9d250 100644 --- a/src/modules/item/selectors.spec.ts +++ b/src/modules/item/selectors.spec.ts @@ -13,7 +13,6 @@ import { mockedItem } from 'specs/item' import { ItemState } from './reducer' import { getAuthorizedItems, - getFilteredRarities, getItem, getItems, getPaginatedCollectionItems, @@ -184,60 +183,6 @@ describe('Item selectors', () => { }) }) - describe('when getting the filtered rarities', () => { - describe('and the feature flag is enabled', () => { - beforeEach(() => { - state = { - ...state, - features: { - data: { - dapps: { - name: 'dapps', - flags: { - 'dapps-exotic-rarity': true - }, - variants: {} - } - }, - error: null, - loading: [], - hasLoadedInitialFlags: true - } - } as RootState - }) - - it('should return the rarities with the exotic rarity', () => { - expect(getFilteredRarities(state)).toEqual(state.item.rarities) - }) - }) - - describe('and the feature flag is not enabled', () => { - beforeEach(() => { - state = { - ...state, - features: { - data: { - dapps: { - name: 'dapps', - flags: { - 'dapps-exotic-rarity': false - }, - variants: {} - } - }, - error: null, - loading: [], - hasLoadedInitialFlags: true - } - } as RootState - }) - - it('should return the rarities without the exotic rarity', () => { - expect(getFilteredRarities(state)).toEqual(state.item.rarities.filter(rarity => rarity.name !== Rarity.EXOTIC)) - }) - }) - }) - describe('when getting the rarities', () => { it('should return the rarities', () => { expect(getRarities(state)).toEqual(state.item.rarities) diff --git a/src/modules/item/selectors.ts b/src/modules/item/selectors.ts index 9a75b5990..145b957e0 100644 --- a/src/modules/item/selectors.ts +++ b/src/modules/item/selectors.ts @@ -1,4 +1,4 @@ -import { Entity, Rarity } from '@dcl/schemas' +import { Entity } from '@dcl/schemas' import { createSelector } from 'reselect' import { isLoadingType } from 'decentraland-dapps/dist/modules/loading/selectors' import { getAddress } from 'decentraland-dapps/dist/modules/wallet/selectors' @@ -13,7 +13,6 @@ import { ItemCuration } from 'modules/curations/itemCuration/types' import { getItemCurationsByItemId } from 'modules/curations/itemCuration/selectors' import { CurationStatus } from 'modules/curations/types' import { getItemThirdParty } from 'modules/thirdParty/selectors' -import { getIsExoticRarityEnabled } from 'modules/features/selectors' import { isUserManagerOfThirdParty } from 'modules/thirdParty/utils' import { isEqual } from 'lib/address' import { buildCatalystItemURN, isThirdParty } from '../../lib/urn' @@ -85,13 +84,6 @@ export const getRarities = (state: RootState): BlockchainRarity[] => { return getState(state).rarities } -// Temporal rarity selector to filter out the exotic rarity in accordance to the feature flag -export const getFilteredRarities = createSelector( - getIsExoticRarityEnabled, - getRarities, - (isExoticRarityEnabled, rarities) => rarities.filter(rarity => isExoticRarityEnabled || rarity.name !== Rarity.EXOTIC) -) - export const getWearables = createSelector(getItems, items => items.filter(item => item.type === ItemType.WEARABLE) )