Skip to content

Commit

Permalink
fix: Correctly get realm objects when trying to delete them
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinBoulongne committed Feb 26, 2025
1 parent ddf0f67 commit ce030f6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion app/src/main/java/com/infomaniak/mail/MainApplication.kt
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ open class MainApplication : Application(), ImageLoaderFactory, DefaultLifecycle

val shouldLog = mutableListOf<Boolean>()

// Sentry events are discarded is the app is in Debug mode
// Sentry events are discarded if the app is in Debug mode
val isInReleaseMode = !BuildConfig.DEBUG
shouldLog.add(isInReleaseMode)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -402,15 +402,14 @@ class ThreadController @Inject constructor(

suspend fun deleteEmptyThreadsInFolder(folderId: String, realm: Realm) {
realm.write {
val emptyThreadsQuery = getEmptyThreadsInFolderQuery(folderId, realm = this)
val emptyThreads = emptyThreadsQuery.find()
val emptyThreads = getEmptyThreadsInFolderQuery(folderId, realm = this).find()
// TODO: Find why we are sometimes displaying empty Threads, and fix it instead of just deleting them.
// It's possibly because we are out of sync, and the situation will resolve by itself shortly?
if (emptyThreads.isNotEmpty()) {
emptyThreads.forEach {
SentryDebug.sendEmptyThread(it, "No Message in a Thread when refreshing a Folder", realm = this)
}
delete(emptyThreadsQuery)
delete(emptyThreads)
}
}
}
Expand Down

0 comments on commit ce030f6

Please sign in to comment.