TF-3189 new option to enable/disable subaddressing for a personal folder

This commit is contained in:
Florent Azavant
2024-10-21 16:29:26 +02:00
committed by Dat H. Pham
parent f8f248fc3c
commit 89d80fe142
36 changed files with 455 additions and 4 deletions
@@ -34,6 +34,7 @@ extension MailboxExtension on Mailbox {
myRights: myRights,
isSubscribed: isSubscribed,
namespace: namespace,
rights: rights
);
}
@@ -51,6 +52,7 @@ extension MailboxExtension on Mailbox {
myRights: updatedProperties.contain(MailboxProperty.myRights) ? newMailbox.myRights : myRights,
isSubscribed: updatedProperties.contain(MailboxProperty.isSubscribed) ? newMailbox.isSubscribed : isSubscribed,
namespace: updatedProperties.contain(MailboxProperty.namespace) ? newMailbox.namespace : namespace,
rights: updatedProperties.contain(MailboxProperty.rights) ? newMailbox.rights : rights,
);
}
@@ -68,6 +70,7 @@ extension MailboxExtension on Mailbox {
myRights: myRights,
isSubscribed: isSubscribed,
namespace: namespace,
rights: rights
);
}
@@ -2,6 +2,7 @@ import 'package:jmap_dart_client/jmap/mail/mailbox/mailbox.dart';
import 'package:jmap_dart_client/jmap/mail/mailbox/namespace.dart';
import 'package:model/mailbox/mailbox_state.dart';
import 'package:model/mailbox/presentation_mailbox.dart';
import 'package:model/mailbox/mailbox_constants.dart';
import 'package:model/mailbox/select_mode.dart';
extension PresentationMailboxExtension on PresentationMailbox {
@@ -49,6 +50,8 @@ extension PresentationMailboxExtension on PresentationMailbox {
bool get isSubscribedMailbox => isSubscribed != null && isSubscribed?.value == true;
bool get isSubaddressingAllowed => rights != null && rights?[anyoneIdentifier]?.contains(postingRight) == true;
bool get allowedToDisplayCountOfUnreadEmails => !(isTrash || isSpam || isDrafts || isTemplates || isSent) && countUnreadEmails > 0;
bool get allowedToDisplayCountOfTotalEmails => (isTrash || isSpam || isDrafts) && countTotalEmails > 0;
@@ -100,6 +103,7 @@ extension PresentationMailboxExtension on PresentationMailbox {
state: state,
namespace: namespace,
displayName: displayName,
rights: rights
);
}
@@ -121,6 +125,7 @@ extension PresentationMailboxExtension on PresentationMailbox {
state: state,
namespace: namespace,
displayName: displayName,
rights: rights
);
}
@@ -142,6 +147,7 @@ extension PresentationMailboxExtension on PresentationMailbox {
state: newMailboxState,
namespace: namespace,
displayName: displayName,
rights: rights
);
}
@@ -159,6 +165,7 @@ extension PresentationMailboxExtension on PresentationMailbox {
myRights: myRights,
isSubscribed: isSubscribed,
namespace: namespace,
rights: rights
);
}
@@ -180,6 +187,7 @@ extension PresentationMailboxExtension on PresentationMailbox {
state: state,
namespace: namespace,
displayName: displayName,
rights: rights
);
}
@@ -201,6 +209,7 @@ extension PresentationMailboxExtension on PresentationMailbox {
state: state,
namespace: namespace,
displayName: displayName,
rights: rights
);
}
}
+2
View File
@@ -0,0 +1,2 @@
const String anyoneIdentifier = 'anyone';
const String postingRight = 'p';
+1
View File
@@ -12,4 +12,5 @@ class MailboxProperty {
static const String myRights = 'myRights';
static const String isSubscribed = 'isSubscribed';
static const String namespace = 'namespace';
static const String rights = 'rights';
}
@@ -48,6 +48,7 @@ class PresentationMailbox with EquatableMixin {
final MailboxState? state;
final Namespace? namespace;
final String? displayName;
final Map<String, List<String>?>? rights;
PresentationMailbox(
this.id,
@@ -67,6 +68,7 @@ class PresentationMailbox with EquatableMixin {
this.state = MailboxState.activated,
this.namespace,
this.displayName,
this.rights
}
);
@@ -88,6 +90,7 @@ class PresentationMailbox with EquatableMixin {
state,
namespace,
displayName,
rights
];
PresentationMailbox copyWith({