Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't show incorrect mail address info on legacy plans #6566

Merged
merged 2 commits into from
Feb 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/misc/TranslationKey.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1625,3 +1625,4 @@ export type TranslationKeyType =
| "yourMessage_label"
| "you_label"
| "emptyString_msg"
| "mailAddressInfoLegacy_msg"
10 changes: 2 additions & 8 deletions src/settings/mailaddress/AddAliasDialog.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { lang, TranslationKey } from "../../misc/LanguageViewModel.js"
import { Dialog } from "../../gui/base/Dialog.js"
import { PlanType, TUTANOTA_MAIL_ADDRESS_DOMAINS } from "../../api/common/TutanotaConstants.js"
import { NewPaidPlans, TUTANOTA_MAIL_ADDRESS_DOMAINS } from "../../api/common/TutanotaConstants.js"
import m from "mithril"
import { SelectMailAddressForm } from "../SelectMailAddressForm.js"
import { ExpanderPanel } from "../../gui/base/Expander.js"
Expand Down Expand Up @@ -59,13 +59,7 @@ export function showAddAliasDialog(model: MailAddressTableModel, isNewPaidPlan:
Dialog.confirm(() => `${lang.get("paidEmailDomainLegacy_msg")}\n${lang.get("changePaidPlan_msg")}`).then(
async (confirmed) => {
if (confirmed) {
isNewPaidPlan = await showPlanUpgradeRequiredDialog([
PlanType.Revolutionary,
PlanType.Legend,
PlanType.Essential,
PlanType.Advanced,
PlanType.Unlimited,
])
isNewPaidPlan = await showPlanUpgradeRequiredDialog(NewPaidPlans)
}
},
)
Expand Down
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")),
m(".small.mt-s", lang.get(model.aliasLimitIncludesCustomDomains() ? "mailAddressInfoLegacy_msg" : "mailAddressInfo_msg")),
]
: 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 onLegacyPlan: 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.onLegacyPlan = 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.onLegacyPlan
}

addresses(): AddressInfo[] {
const { nameMappings } = this
if (nameMappings == null) {
Expand Down
3 changes: 2 additions & 1 deletion src/translations/de.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1643,6 +1643,7 @@ export default {
"yourCalendars_label": "Deine Kalender",
"yourFolders_action": "DEINE ORDNER",
"yourMessage_label": "Deine Nachricht",
"you_label": "Du"
"you_label": "Du",
"mailAddressInfoLegacy_msg": "Deaktivierte E-Mail-Adressen können einer anderen Mailbox innerhalb deines Kontos zugewiesen werden."
}
}
3 changes: 2 additions & 1 deletion src/translations/de_sie.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1643,6 +1643,7 @@ export default {
"yourCalendars_label": "Deine Kalender",
"yourFolders_action": "Ihre ORDNER",
"yourMessage_label": "Ihre Nachricht",
"you_label": "Sie"
"you_label": "Sie",
"mailAddressInfoLegacy_msg": "Deaktivierte E-Mail-Adressen können einer anderen Mailbox innerhalb Ihres Kontos zugewiesen werden."
}
}
3 changes: 2 additions & 1 deletion src/translations/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1639,6 +1639,7 @@ export default {
"yourCalendars_label": "Your calendars",
"yourFolders_action": "YOUR FOLDERS",
"yourMessage_label": "Your message",
"you_label": "You"
"you_label": "You",
"mailAddressInfoLegacy_msg": "Disabled email addresses can be reassigned to another user or mailbox within your account."
}
}
Loading