Add has_vpn property to Profile
This will allow the UI to determine whether to show Bundle callouts.
This commit is contained in:
Родитель
5f2b56fee4
Коммит
d7f2aa45b2
|
@ -39,4 +39,5 @@ PHONE_PROD_ID=prod_LgQiSgNi4xL7dq
|
|||
BUNDLE_PROD_ID=prod_MIex7Q079igFZJ
|
||||
SUBSCRIPTIONS_WITH_UNLIMITED="monitor-unlimited,mozilla-one,guardian_vpn,premium-relay"
|
||||
SUBSCRIPTIONS_WITH_PHONE="relay-phones,"
|
||||
SUBSCRIPTIONS_WITH_VPN="guardian_vpn_1"
|
||||
MAX_ONBOARDING_AVAILABLE=3
|
||||
|
|
|
@ -114,6 +114,7 @@ class ProfileSerializer(serializers.ModelSerializer):
|
|||
"subdomain",
|
||||
"has_premium",
|
||||
"has_phone",
|
||||
"has_vpn",
|
||||
"onboarding_state",
|
||||
"date_subscribed",
|
||||
"avatar",
|
||||
|
@ -130,6 +131,7 @@ class ProfileSerializer(serializers.ModelSerializer):
|
|||
"id",
|
||||
"has_premium",
|
||||
"has_phone",
|
||||
"has_vpn",
|
||||
"date_subscribed",
|
||||
"avatar",
|
||||
"next_email_try",
|
||||
|
|
|
@ -297,6 +297,16 @@ class Profile(models.Model):
|
|||
return True
|
||||
return False
|
||||
|
||||
@property
|
||||
def has_vpn(self):
|
||||
if not self.fxa:
|
||||
return False
|
||||
user_subscriptions = self.fxa.extra_data.get("subscriptions", [])
|
||||
for sub in settings.SUBSCRIPTIONS_WITH_VPN.split(","):
|
||||
if sub in user_subscriptions:
|
||||
return True
|
||||
return False
|
||||
|
||||
@property
|
||||
def emails_forwarded(self):
|
||||
return (
|
||||
|
|
|
@ -19,6 +19,7 @@ export function getMockProfileData(profileData?: MockData): ProfileData {
|
|||
return {
|
||||
has_premium: false,
|
||||
has_phone: false,
|
||||
has_vpn: false,
|
||||
store_phone_log: true,
|
||||
id: 0,
|
||||
server_storage: true,
|
||||
|
|
|
@ -110,6 +110,7 @@ export const mockedProfiles: Record<typeof mockIds[number], ProfileData> = {
|
|||
remove_level_one_email_trackers: false,
|
||||
has_premium: false,
|
||||
has_phone: false,
|
||||
has_vpn: false,
|
||||
id: 0,
|
||||
next_email_try: "2020-04-09T00:00:00.000Z",
|
||||
onboarding_state: 0,
|
||||
|
@ -129,6 +130,7 @@ export const mockedProfiles: Record<typeof mockIds[number], ProfileData> = {
|
|||
remove_level_one_email_trackers: false,
|
||||
has_premium: true,
|
||||
has_phone: true,
|
||||
has_vpn: false,
|
||||
id: 1,
|
||||
next_email_try: "2020-04-09T00:00:00.000Z",
|
||||
onboarding_state: 0,
|
||||
|
@ -148,6 +150,7 @@ export const mockedProfiles: Record<typeof mockIds[number], ProfileData> = {
|
|||
remove_level_one_email_trackers: false,
|
||||
has_premium: true,
|
||||
has_phone: true,
|
||||
has_vpn: false,
|
||||
id: 2,
|
||||
next_email_try: "2020-04-09T00:00:00.000Z",
|
||||
onboarding_state: 3,
|
||||
|
@ -167,6 +170,7 @@ export const mockedProfiles: Record<typeof mockIds[number], ProfileData> = {
|
|||
remove_level_one_email_trackers: true,
|
||||
has_premium: true,
|
||||
has_phone: true,
|
||||
has_vpn: true,
|
||||
id: 3,
|
||||
next_email_try: "2020-04-09T00:00:00.000Z",
|
||||
onboarding_state: 3,
|
||||
|
|
|
@ -7,6 +7,7 @@ export type ProfileData = {
|
|||
server_storage: boolean;
|
||||
has_premium: boolean;
|
||||
has_phone: boolean;
|
||||
has_vpn: boolean;
|
||||
subdomain: string | null;
|
||||
onboarding_state: number;
|
||||
avatar: string;
|
||||
|
|
|
@ -720,6 +720,7 @@ BUNDLE_PLAN_COUNTRY_LANG_MAPPING = {
|
|||
|
||||
SUBSCRIPTIONS_WITH_UNLIMITED = config("SUBSCRIPTIONS_WITH_UNLIMITED", default="")
|
||||
SUBSCRIPTIONS_WITH_PHONE = config("SUBSCRIPTIONS_WITH_PHONE", default="")
|
||||
SUBSCRIPTIONS_WITH_VPN = config("SUBSCRIPTIONS_WITH_VPN", default="")
|
||||
|
||||
MAX_ONBOARDING_AVAILABLE = config("MAX_ONBOARDING_AVAILABLE", 0, cast=int)
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче