@@ -286,34 +286,23 @@ class DraftsActionsWorker @AssistedInject constructor(
286
286
var scheduledDate: String? = null
287
287
var savedDraftUuid: String? = null
288
288
289
- // TODO: Remove this whole `draft.attachments.forEach { … }` when the Attachment issue is fixed.
290
- draft.attachments.forEach { attachment ->
291
- if (attachment.uploadStatus != UploadStatus .FINISHED ) {
292
-
293
- Sentry .withScope { scope ->
294
- scope.setExtra(" attachmentUuid" , attachment.uuid)
295
- scope.setExtra(" attachmentsCount" , " ${draft.attachments.count()} " )
296
- scope.setExtra(
297
- " attachmentsUuids to attachmentsLocalUuid" ,
298
- " ${draft.attachments.map { it.uuid to it.localUuid }} " ,
299
- )
300
- scope.setExtra(" draftUuid" , " ${draft.remoteUuid} " )
301
- scope.setExtra(" draftLocalUuid" , draft.localUuid)
302
- scope.setExtra(" email" , AccountUtils .currentMailboxEmail.toString())
303
- Sentry .captureMessage(
304
- " We tried to [${draft.action?.name} ] a Draft, but an Attachment wasn't uploaded." ,
305
- SentryLevel .ERROR ,
306
- )
307
- }
289
+ SentryDebug .addAttachmentsBreadcrumb(draft)
308
290
309
- return DraftActionResult (
310
- realmActionOnDraft = null ,
311
- scheduledDate = null ,
312
- errorMessageResId = R .string.errorCorruptAttachment,
313
- savedDraftUuid = null ,
314
- isSuccess = false ,
315
- )
316
- }
291
+ // TODO: Remove this whole `draft.attachments.any { … }` + `addAttachmentsBreadcrumb()` when the Attachments issue is fixed.
292
+ if (draft.attachments.any { it.uploadStatus != UploadStatus .FINISHED }) {
293
+
294
+ Sentry .captureMessage(
295
+ " We tried to [${draft.action?.name} ] a Draft, but an Attachment wasn't uploaded." ,
296
+ SentryLevel .ERROR ,
297
+ )
298
+
299
+ return DraftActionResult (
300
+ realmActionOnDraft = null ,
301
+ scheduledDate = null ,
302
+ errorMessageResId = R .string.errorCorruptAttachment,
303
+ savedDraftUuid = null ,
304
+ isSuccess = false ,
305
+ )
317
306
}
318
307
319
308
fun executeSaveAction () = with (ApiRepository .saveDraft(mailboxUuid, draft, okHttpClient)) {
0 commit comments