Skip to content

Commit

Permalink
fixup! TF-2302 Fix delete folder
Browse files Browse the repository at this point in the history
Signed-off-by: dab246 <[email protected]>
  • Loading branch information
dab246 committed Nov 8, 2023
1 parent 503ccd1 commit e3be9cb
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 14 deletions.
8 changes: 4 additions & 4 deletions lib/features/base/mixin/handle_error_mixin.dart
Original file line number Diff line number Diff line change
Expand Up @@ -56,20 +56,20 @@ mixin HandleSetErrorMixin {
}
}

List<MapEntry<Id, SetError>> handleSetResponse(List<SetResponse?> listSetResponse) {
Map<Id, SetError> handleSetResponse(List<SetResponse?> listSetResponse) {
final listSetResponseNotNull = listSetResponse.whereNotNull().toList();
if (listSetResponseNotNull.isEmpty) {
return [];
return <Id, SetError>{};
}

final List<MapEntry<Id, SetError>> remainedErrors = [];
final Map<Id, SetError> remainedErrors = <Id, SetError>{};
for (var response in listSetResponseNotNull) {
handleSetErrors(
notDestroyedError: response.notDestroyed,
notUpdatedError: response.notUpdated,
notCreatedError: response.notCreated,
unCatchErrorHandler: (setErrorEntry) {
remainedErrors.add(setErrorEntry);
remainedErrors.addEntries({setErrorEntry});
return false;
}
);
Expand Down
9 changes: 3 additions & 6 deletions lib/features/email/data/network/email_api.dart
Original file line number Diff line number Diff line change
Expand Up @@ -204,12 +204,11 @@ class EmailAPI with HandleSetErrorMixin {
}

final emailCreated = setEmailResponse?.created?[idCreateMethod];
final listEntriesErrors = handleSetResponse([
final mapErrors = handleSetResponse([
setEmailResponse,
setEmailSubmissionResponse,
markAsAnsweredOrForwardedSetResponse
]);
final mapErrors = Map.fromEntries(listEntriesErrors);

if (emailCreated != null && mapErrors.isEmpty) {
return true;
Expand Down Expand Up @@ -482,8 +481,7 @@ class EmailAPI with HandleSetErrorMixin {
);

final emailCreated = setEmailResponse?.created?[idCreateMethod];
final listEntriesErrors = handleSetResponse([setEmailResponse]);
final mapErrors = Map.fromEntries(listEntriesErrors);
final mapErrors = handleSetResponse([setEmailResponse]);

if (emailCreated != null && mapErrors.isEmpty) {
return emailCreated;
Expand Down Expand Up @@ -549,8 +547,7 @@ class EmailAPI with HandleSetErrorMixin {

final emailUpdated = setEmailResponse?.created?[idCreateMethod];
final isEmailDeleted = setEmailResponse?.destroyed?.contains(oldEmailId.id);
final listEntriesErrors = handleSetResponse([setEmailResponse]);
final mapErrors = Map.fromEntries(listEntriesErrors);
final mapErrors = handleSetResponse([setEmailResponse]);

if (emailUpdated != null && isEmailDeleted == true && mapErrors.isEmpty) {
return emailUpdated;
Expand Down
5 changes: 1 addition & 4 deletions lib/features/mailbox/data/network/mailbox_api.dart
Original file line number Diff line number Diff line change
Expand Up @@ -281,10 +281,7 @@ class MailboxAPI with HandleSetErrorMixin {
if (setMailboxResponse?.updated?.containsKey(request.mailboxId.id) == true) {
return true;
} else {
final listEntriesErrors = handleSetResponse([
setMailboxResponse,
]);
final mapErrors = Map.fromEntries(listEntriesErrors);
final mapErrors = handleSetResponse([setMailboxResponse]);
throw SetMethodException(mapErrors);
}
}
Expand Down

0 comments on commit e3be9cb

Please sign in to comment.