Skip to content

Commit

Permalink
Enable labels based on Customer customizations
Browse files Browse the repository at this point in the history
  • Loading branch information
charlag committed Nov 11, 2024
1 parent e0871d1 commit 938ce86
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/common/api/common/TutanotaConstants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -515,8 +515,8 @@ export enum FeatureType {
AffiliatePartner = "12",
KnowledgeBase = "13",
Newsletter = "14",
Blobs = "15", // enables blob attachments for mails
MailDetails = "16", // enable new mail model support
Labels = "15", // enables blob attachments for mails
Unused16 = "16",
MultipleUsers = "17", // Multi-user support for new personal plans.
}

Expand Down
2 changes: 1 addition & 1 deletion src/mail-app/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ import("./translations/en.js")
async onFullLoginSuccess() {
await mailLocator.groupManagementFacade.migrateLocalAdminsToGlobalAdmins()

if (!mailLocator.logins.getUserController().props.defaultLabelCreated) {
if (mailLocator.mailModel.canManageLabels() && !mailLocator.logins.getUserController().props.defaultLabelCreated) {
const mailboxDetail = await mailLocator.mailboxModel.getMailboxDetails()

mailLocator.mailFacade
Expand Down
6 changes: 5 additions & 1 deletion src/mail-app/mail/model/MailModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -411,8 +411,12 @@ export class MailModel {
return this.logins.getUserController().isInternalUser()
}

canManageLabels(): boolean {
return this.logins.getUserController().isInternalUser() && this.logins.isEnabled(FeatureType.Labels)
}

canAssignLabels(): boolean {
return this.logins.getUserController().isInternalUser()
return this.logins.getUserController().isInternalUser() && this.logins.isEnabled(FeatureType.Labels)
}

isExportingMailsAllowed(): boolean {
Expand Down
8 changes: 5 additions & 3 deletions src/mail-app/mail/view/MailView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -616,9 +616,11 @@ export class MailView extends BaseTopLevelView implements TopLevelView<MailViewA
this.createMailboxFolderItems(mailboxDetail, inEditMode, () => {
EditFoldersDialog.showEdit(() => this.renderFoldersAndLabels(mailboxDetail.mailGroup._id))
}),
this.renderMailboxLabelItems(mailboxDetail, inEditMode, () => {
EditFoldersDialog.showEdit(() => this.renderFoldersAndLabels(mailboxDetail.mailGroup._id))
}),
mailLocator.mailModel.canManageLabels()
? this.renderMailboxLabelItems(mailboxDetail, inEditMode, () => {
EditFoldersDialog.showEdit(() => this.renderFoldersAndLabels(mailboxDetail.mailGroup._id))
})
: null,
],
)
}
Expand Down

0 comments on commit 938ce86

Please sign in to comment.