Skip to content

Commit

Permalink
TF-1704 Fix weird infinity loop when delete folder on server CYRUS
Browse files Browse the repository at this point in the history
Signed-off-by: dab246 <tdvu@linagora.com>
  • Loading branch information
dab246 committed Oct 30, 2023
1 parent a7b9020 commit a1e227e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
13 changes: 9 additions & 4 deletions lib/features/email/data/network/email_api.dart
Original file line number Diff line number Diff line change
Expand Up @@ -365,12 +365,17 @@ class EmailAPI with HandleSetErrorMixin {
AccountId accountId,
MoveToMailboxRequest moveRequest
) async {

requireCapability(moveRequest.session, accountId, [CapabilityIdentifier.jmapCore, CapabilityIdentifier.jmapMail]);
requireCapability(
moveRequest.session,
accountId,
[CapabilityIdentifier.jmapCore, CapabilityIdentifier.jmapMail]
);

final coreCapability = moveRequest.session.getCapabilityProperties<CoreCapability>(
accountId, CapabilityIdentifier.jmapCore);
final maxMethodCount = coreCapability.maxCallsInRequest?.value.toInt() ?? 0;
accountId,
CapabilityIdentifier.jmapCore
);
final maxMethodCount = coreCapability.maxCallsInRequest?.value.toInt() ?? CapabilityIdentifierExtension.defaultMaxCallsInRequest;

var start = 0;
var end = 0;
Expand Down
7 changes: 4 additions & 3 deletions lib/features/mailbox/data/network/mailbox_api.dart
Original file line number Diff line number Diff line change
Expand Up @@ -186,10 +186,11 @@ class MailboxAPI with HandleSetErrorMixin {
}

Future<Map<Id, SetError>> deleteMultipleMailbox(Session session, AccountId accountId, List<MailboxId> mailboxIds) async {

final coreCapability = session.getCapabilityProperties<CoreCapability>(
accountId, CapabilityIdentifier.jmapCore);
final maxMethodCount = coreCapability.maxCallsInRequest?.value.toInt() ?? 0;
accountId,
CapabilityIdentifier.jmapCore
);
final maxMethodCount = coreCapability.maxCallsInRequest?.value.toInt() ?? CapabilityIdentifierExtension.defaultMaxCallsInRequest;

final Map<Id,SetError> finalDeletedMailboxErrors = {};
var start = 0;
Expand Down
2 changes: 2 additions & 0 deletions lib/main/error/capability_validator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ extension ListCapabilityIdentifierExtension on List<CapabilityIdentifier> {

extension CapabilityIdentifierExtension on CapabilityIdentifier {

static const int defaultMaxCallsInRequest = 1;

bool isSupported(Session session, AccountId accountId) {
try {
requireCapability(session, accountId, [this]);
Expand Down

0 comments on commit a1e227e

Please sign in to comment.