feat: Messages actions use case#2819
feat: Messages actions use case#2819solrubado wants to merge 15 commits intoprotected/refactor-mail-actionsfrom
Conversation
8a8e99a to
73350ef
Compare
b80a46a to
3a7ff5e
Compare
e6d2918 to
cde5dde
Compare
|
This PR/issue depends on:
|
3a7ff5e to
3db2f00
Compare
|
| } else { | ||
| FolderRole.SPAM | ||
| if (displaySnackbar && result != null) { | ||
| showMoveSnackbar(result.movedThreads, result.messages, result.apiResponses, result.destinationFolder) |
There was a problem hiding this comment.
| showMoveSnackbar(result.movedThreads, result.messages, result.apiResponses, result.destinationFolder) | |
| with(result) { showMoveSnackbar(movedThreads, messages, apiResponses, destinationFolder) } |
| restrictions.apply { | ||
| blockedSenders.removeIf { it.email == email } | ||
| } |
There was a problem hiding this comment.
| restrictions.apply { | |
| blockedSenders.removeIf { it.email == email } | |
| } | |
| restrictions.blockedSenders.removeIf { it.email == email } |
| } | ||
|
|
||
| sealed class ApiCallResult { | ||
| data class Success(val messageRes: Int) : ApiCallResult() |
There was a problem hiding this comment.
Why did you put a message in success ? I don't think we need it
| else -> listOf(message) | ||
| } | ||
|
|
||
| suspend fun getMessagesFromThreadsToMove(threads: List<Thread>): List<Message> { |
There was a problem hiding this comment.
This and the getMessagesFromThreadsToMarkAsUnseen are different from the other getMessagesFromThreadTo
(threads vs thread)
| val result = messagesActionsUseCase.undoAction(undoData, mailbox) | ||
| val message = when (result) { |
There was a problem hiding this comment.
Put the result directly in when
|
|
||
| private suspend fun moveOutThreadsLocally(messages: List<Message>, destinationFolder: Folder): List<String> { | ||
| val uidsToMove = mutableListOf<String>().apply { | ||
| messages.flatMapTo(mutableSetOf(), Message::threads).forEach { thread -> |
There was a problem hiding this comment.
I see that you now open the realm to get the thread, why do you need to do it now ?
| resources = apiResponses.mapNotNull { it.data?.undoResource }, | ||
| foldersIds = foldersIds, | ||
| destinationFolderId = undoDestinationId, | ||
| threadsMovedCount > 0 || messagesMoved.count() > 1 -> appContext.resources.getQuantityString( |
There was a problem hiding this comment.
Add curly bracket and put the getQuantityString on a new line
| val destinationFolderRole = if (folderRole == FolderRole.SPAM) { | ||
| FolderRole.INBOX | ||
| } else { | ||
| FolderRole.SPAM | ||
| } |
| if (apiResponses.atLeastOneFailed()) threadController.updateIsLocallyMovedOutStatus( | ||
| threadsUids = uidsToMove, | ||
| hasBeenMovedOut = false, | ||
| ) |
There was a problem hiding this comment.
| if (apiResponses.atLeastOneFailed()) threadController.updateIsLocallyMovedOutStatus( | |
| threadsUids = uidsToMove, | |
| hasBeenMovedOut = false, | |
| ) | |
| if (apiResponses.atLeastOneFailed()) { | |
| threadController.updateIsLocallyMovedOutStatus( | |
| threadsUids = uidsToMove, | |
| hasBeenMovedOut = false, | |
| ) | |
| } | |
| val undoDestinationId = messagesToDelete.first().folderId | ||
| val undoFoldersIds = messagesToDelete.getFoldersIds(exception = undoDestinationId) |
There was a problem hiding this comment.
Are this necessary if there are no undo action possible ?



Depends on #2814