From f0b03ef780e62c96c599fea045d6bc0918e8ca11 Mon Sep 17 00:00:00 2001 From: paw Date: Fri, 16 Feb 2024 15:29:37 +0100 Subject: [PATCH] Don't show incorrect mail address info on legacy plans It is not true that legacy plans can have unlimited custom domains. Make it not display anything here to prevent confusion. Fixes #6540 --- src/settings/mailaddress/MailAddressTable.ts | 3 +-- src/settings/mailaddress/MailAddressTableModel.ts | 10 ++++++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/settings/mailaddress/MailAddressTable.ts b/src/settings/mailaddress/MailAddressTable.ts index ebaf718bcd27..879165d901a5 100644 --- a/src/settings/mailaddress/MailAddressTable.ts +++ b/src/settings/mailaddress/MailAddressTable.ts @@ -17,7 +17,6 @@ import { AddressInfo, AddressStatus, MailAddressTableModel } from "./MailAddress import { showAddAliasDialog } from "./AddAliasDialog.js" import { locator } from "../../api/main/MainLocator.js" import { UpgradeRequiredError } from "../../api/main/UpgradeRequiredError.js" -import { PlanType } from "../../api/common/TutanotaConstants.js" assertMainOrNode() @@ -78,7 +77,7 @@ export class MailAddressTable implements Component { "{totalAmount}": model.aliasCount.totalAliases, }), ), - m(".small.mt-s", lang.get("mailAddressInfo_msg")), + model.userNotOnLegacyPlan() ? m(".small.mt-s", lang.get("mailAddressInfo_msg")) : null, ] : null, ] diff --git a/src/settings/mailaddress/MailAddressTableModel.ts b/src/settings/mailaddress/MailAddressTableModel.ts index db1fc039d511..4fa9f662b8f9 100644 --- a/src/settings/mailaddress/MailAddressTableModel.ts +++ b/src/settings/mailaddress/MailAddressTableModel.ts @@ -43,10 +43,16 @@ export interface MailAddressNameChanger { /** Model for showing the list of mail addresses and optionally adding more, enabling/disabling/setting names for them. */ export class MailAddressTableModel { private nameMappings: AddressToName | null = null + private notOnLegacyPlan: boolean = false aliasCount: MailAddressAliasServiceReturn | null = null init: () => Promise = lazyMemoized(async () => { this.eventController.addEntityListener(this.entityEventsReceived) + + // important: "not on legacy plan" is true for free plans + const userController = this.logins.getUserController() + this.notOnLegacyPlan = !userController.isLegacyPlan(await userController.getPlanType()) + await this.loadNames() this.redraw() await this.loadAliasCount() @@ -72,6 +78,10 @@ export class MailAddressTableModel { return this.logins.getUserController().isGlobalAdmin() } + userNotOnLegacyPlan(): boolean { + return this.notOnLegacyPlan + } + addresses(): AddressInfo[] { const { nameMappings } = this if (nameMappings == null) {