Skip to content

Commit

Permalink
Don't show incorrect mail address info on legacy plans
Browse files Browse the repository at this point in the history
It is not true that legacy plans can have unlimited custom domains. Make
it not display anything here to prevent confusion.

Fixes #6540
  • Loading branch information
paw-hub committed Feb 16, 2024
1 parent 005a580 commit 4e0090e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
3 changes: 1 addition & 2 deletions src/settings/mailaddress/MailAddressTable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down Expand Up @@ -78,7 +77,7 @@ export class MailAddressTable implements Component<MailAddressTableAttrs> {
"{totalAmount}": model.aliasCount.totalAliases,
}),
),
m(".small.mt-s", lang.get("mailAddressInfo_msg")),
model.aliasLimitIncludesCustomDomains() ? m(".small.mt-s", lang.get("mailAddressInfo_msg")) : null,
]
: null,
]
Expand Down
10 changes: 10 additions & 0 deletions src/settings/mailaddress/MailAddressTableModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<void> = 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()
Expand All @@ -72,6 +78,10 @@ export class MailAddressTableModel {
return this.logins.getUserController().isGlobalAdmin()
}

aliasLimitIncludesCustomDomains(): boolean {
return this.notOnLegacyPlan
}

addresses(): AddressInfo[] {
const { nameMappings } = this
if (nameMappings == null) {
Expand Down

0 comments on commit 4e0090e

Please sign in to comment.