Skip to content

Commit

Permalink
The action required value is never used so we don't need to store it …
Browse files Browse the repository at this point in the history
…in a cookie
  • Loading branch information
rupertbates committed Jan 7, 2025
1 parent 4fff305 commit ca40452
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ const getAuthStatus = getAuthStatus_ as jest.MockedFunction<
const PERSISTENCE_KEYS = {
USER_FEATURES_EXPIRY_COOKIE: 'gu_user_features_expiry',
AD_FREE_USER_COOKIE: 'GU_AF1',
ACTION_REQUIRED_FOR_COOKIE: 'gu_action_required_for',
SUPPORT_ONE_OFF_CONTRIBUTION_COOKIE: 'gu.contributions.contrib-timestamp',
HIDE_SUPPORT_MESSAGING_COOKIE: 'gu_hide_support_messaging',
};
Expand All @@ -62,16 +61,11 @@ const setAllFeaturesData = (opts: { isExpired: boolean }) => {
name: PERSISTENCE_KEYS.USER_FEATURES_EXPIRY_COOKIE,
value: expiryDate.getTime().toString(),
});
setCookie({
name: PERSISTENCE_KEYS.ACTION_REQUIRED_FOR_COOKIE,
value: 'test',
});
};

const deleteAllFeaturesData = () => {
removeCookie({ name: PERSISTENCE_KEYS.USER_FEATURES_EXPIRY_COOKIE });
removeCookie({ name: PERSISTENCE_KEYS.AD_FREE_USER_COOKIE });
removeCookie({ name: PERSISTENCE_KEYS.ACTION_REQUIRED_FOR_COOKIE });
removeCookie({ name: PERSISTENCE_KEYS.HIDE_SUPPORT_MESSAGING_COOKIE });
};

Expand Down
11 changes: 0 additions & 11 deletions dotcom-rendering/src/client/userFeatures/user-features.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import {
import type { UserFeaturesResponse } from './user-features-lib';

const USER_FEATURES_EXPIRY_COOKIE = 'gu_user_features_expiry';
const ACTION_REQUIRED_FOR_COOKIE = 'gu_action_required_for';
const HIDE_SUPPORT_MESSAGING_COOKIE = 'gu_hide_support_messaging';
const AD_FREE_USER_COOKIE = 'GU_AF1';

Expand All @@ -36,7 +35,6 @@ const forcedAdFreeMode = !!/[#&]noadsaf(&.*)?$/.exec(window.location.hash);
const userHasData = () => {
const cookie =
getAdFreeCookie() ??
getCookie({ name: ACTION_REQUIRED_FOR_COOKIE }) ??
getCookie({ name: USER_FEATURES_EXPIRY_COOKIE }) ??
getCookie({ name: HIDE_SUPPORT_MESSAGING_COOKIE });
return !!cookie;
Expand Down Expand Up @@ -65,14 +63,6 @@ const persistResponse = (JsonResponse: UserFeaturesResponse) => {
value: String(!JsonResponse.showSupportMessaging),
});

removeCookie({ name: ACTION_REQUIRED_FOR_COOKIE });
if (JsonResponse.alertAvailableFor) {
setCookie({
name: ACTION_REQUIRED_FOR_COOKIE,
value: JsonResponse.alertAvailableFor,
});
}

if (JsonResponse.contentAccess.digitalPack) {
setAdFreeCookie(2);
} else if (adFreeDataIsPresent() && !forcedAdFreeMode) {
Expand All @@ -83,7 +73,6 @@ const persistResponse = (JsonResponse: UserFeaturesResponse) => {
const deleteOldData = (): void => {
removeCookie({ name: AD_FREE_USER_COOKIE });
removeCookie({ name: USER_FEATURES_EXPIRY_COOKIE });
removeCookie({ name: ACTION_REQUIRED_FOR_COOKIE });
removeCookie({ name: HIDE_SUPPORT_MESSAGING_COOKIE });
};

Expand Down

0 comments on commit ca40452

Please sign in to comment.