Skip to content

Commit

Permalink
refactor(admin): rename blacklist -> denylist
Browse files Browse the repository at this point in the history
  • Loading branch information
LoneRifle committed Jul 22, 2024
1 parent 0968c7d commit c67e487
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ const ConfirmationStep = ({
* These booleans determine if the different orange checkers should be shown.
* If vouchers have claimed before, show orange claimed before orange checkers
* If not claimed before and it's a whitelist campaign, show if not in whitelist if user not in whitelist
* If not claimed before and campaign is address type, show if address in blacklist else dont show any orange checker
* If not claimed before and campaign is address type, show if address in denylist else dont show any orange checker
*/
const isShowRecipientIdClaimedBefore =
voucherRecipientIdParam && !isSearchRecipientIdResultsHidden
Expand All @@ -174,7 +174,7 @@ const ConfirmationStep = ({

const isShowAddressClaimedBefore =
voucherPostalCodeParam && !isSearchAddressesResultsHidden
const isShowAddressInBlacklist =
const isShowAddressInDenylist =
voucherPostalCodeParam &&
isCreateVoucherAddressUsePrefill &&
isSearchAddressesResultsHidden
Expand All @@ -187,7 +187,7 @@ const ConfirmationStep = ({
isShowRecipientIdNotInWhitelist ||
!voucherPostalCodeParam ||
isShowAddressClaimedBefore ||
isShowAddressInBlacklist
isShowAddressInDenylist

const formattedAddress = formatAddress({
voucherBlockNumberParam,
Expand Down Expand Up @@ -324,9 +324,9 @@ const ConfirmationStep = ({
showIcon
/>
)}
{isShowAddressInBlacklist && (
{isShowAddressInDenylist && (
<CheckerResult
id="confirmation-step-address-checker-in-blacklist"
id="confirmation-step-address-checker-in-denylist"
text={
<VStack align="start" spacing="8px">
<Text textStyle="subhead1" color="neutral.800">
Expand Down
8 changes: 4 additions & 4 deletions packages/admin/src/services/RedeemApi/RedeemApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -676,7 +676,7 @@ function getTwilioCredentials(campaignId: string): Promise<TwilioCredentials> {
.then((res) => res.data)
}

function checkIfAddressInBlacklistForCampaign({
function checkIfAddressInDenylistForCampaign({
block,
floor,
unit,
Expand All @@ -689,10 +689,10 @@ function checkIfAddressInBlacklistForCampaign({
postalCode: string
campaignId: string
}) {
log('[INFO] checkIfAddressInBlacklistForCampaign')
log('[INFO] checkIfAddressInDenylistForCampaign')
const headers = getAuthorizationHeader()
return baseConfig
.get(`/campaigns/${campaignId}/blacklist`, {
.get(`/campaigns/${campaignId}/denylist`, {
headers,
params: {
block,
Expand Down Expand Up @@ -945,7 +945,7 @@ export {
addTwilioCredentials,
getTwilioCredentials,
fetchCampaignMetrics,
checkIfAddressInBlacklistForCampaign,
checkIfAddressInDenylistForCampaign,
// Vouchers
fetchAllVouchersByCampaignId,
createVoucherForCampaign,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ test.describe('Campaign page voucher tab tests', () => {
await vouchersTabPage.mockGetCampaignVouchersOkResponse()
await vouchersTabPage.mockGetTwilioCredentialsOkResponse()
await vouchersTabPage.mockGetTwilioSmsUsageOkResponse()
await vouchersTabPage.mockCheckAddressInBlacklistResponse(false)
await vouchersTabPage.mockCheckAddressInDenylistResponse(false)
})

test('Should show correct vouchers when next or previous page is clicked and show correct pagination state', async ({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import qs, { ParsedQs } from 'qs'
import { baseTest } from '../../../base.fixture'
import {
API_CAMPAIGN_VOUCHERS_PAGE_1_END_CURSOR,
API_ROUTE_ADDRESS_IN_BLACKLIST_CHECK,
API_ROUTE_ADDRESS_IN_DENYLIST_CHECK,
API_ROUTE_CREATE_CAMPAIGN_VOUCHERS,
API_ROUTE_GET_CAMPAIGN_VOUCHERS,
API_ROUTE_GET_PRINT_GROUPED_VOUCHERS,
Expand Down Expand Up @@ -265,9 +265,9 @@ export class VouchersTabPage extends CampaignPage {
)
}

async mockCheckAddressInBlacklistResponse(result: boolean) {
async mockCheckAddressInDenylistResponse(result: boolean) {
await this.page.route(
`${API_URL}${API_ROUTE_ADDRESS_IN_BLACKLIST_CHECK}`,
`${API_URL}${API_ROUTE_ADDRESS_IN_DENYLIST_CHECK}`,
(route) => {
return route.fulfill({
status: 200,
Expand Down Expand Up @@ -421,7 +421,7 @@ export class VouchersTabPage extends CampaignPage {

async expectAddressNotEligibleNotVisibleInConfirmationPage(): Promise<void> {
const checkerResult = this.page.locator(
'#confirmation-step-address-checker-in-blacklist'
'#confirmation-step-address-checker-in-denylist'
)

await expect(
Expand All @@ -431,7 +431,7 @@ export class VouchersTabPage extends CampaignPage {

async expectAddressNotEligibleVisibleInConfirmationPage(): Promise<void> {
const checkerResult = this.page.locator(
'#confirmation-step-address-checker-in-blacklist'
'#confirmation-step-address-checker-in-denylist'
)

await expect(
Expand All @@ -456,15 +456,15 @@ export class VouchersTabPage extends CampaignPage {
expectAddressNotEligibleMessageVisible(): Promise<void> {
return expect(
this.page
.locator('#address-in-blacklist-checker-result-see-details-button')
.locator('#address-in-denylist-checker-result-see-details-button')
.locator('text="Address not eligible for campaign"')
).toBeVisible()
}

expectAddressNotEligibleMessageNotVisible(): Promise<void> {
return expect(
this.page.locator(
'#address-in-blacklist-checker-result-see-details-button'
'#address-in-denylist-checker-result-see-details-button'
)
).toHaveCount(0)
}
Expand Down
4 changes: 2 additions & 2 deletions packages/admin/tests/e2e/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ export const API_ROUTE_CREATE_CAMPAIGN_VOUCHERS =
'/v1/campaigns/*/vouchers/create-group'
export const API_ROUTE_RECIPIENT_WHITELIST_CHECK =
'/v1/campaigns/*/whitelist/check?**'
export const API_ROUTE_ADDRESS_IN_BLACKLIST_CHECK =
'/v1/campaigns/*/blacklist?**'
export const API_ROUTE_ADDRESS_IN_DENYLIST_CHECK =
'/v1/campaigns/*/denylist?**'
export const API_URL =
process.env.REACT_APP_REDEEM_URL || 'http://localhost:10000'
export const DEFAULT_RESPONSE_HEADERS = { 'Access-Control-Allow-Origin': '*' }
Expand Down

0 comments on commit c67e487

Please sign in to comment.