Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#2292 Fix: deleted messages are still visible in thread #2297

Merged
merged 2 commits into from
Jul 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion FlowCrypt/App/GeneralConstants.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ enum GeneralConstants {
static let redirectURL = URL(string: "com.googleusercontent.apps.679326713487-5r16ir2f57bpmuh2d6dal1bcm9m1ffqc:/oauthredirect")!
static let mailScope: [GoogleScope] = [.userInfo, .userEmail, .mail]
static let contactsScope: [GoogleScope] = mailScope + [.contacts, .otherContacts]
static let trashLabelPath = "TRASH"
// Empty pass is For All MAIL
static let standardGmailPaths = ["INBOX", "CHAT", "SENT", "IMPORTANT", "TRASH", "DRAFT", "SPAM", "STARRED", "UNREAD", ""]
static let standardGmailPaths = ["INBOX", "CHAT", "SENT", "IMPORTANT", trashLabelPath, "DRAFT", "SPAM", "STARRED", "UNREAD", ""]
static let gmailRecoveryEmailSubjects = [
"Your FlowCrypt Backup",
"Your CryptUp Backup",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,13 @@ extension GmailService: MessagesThreadApiClient {
return continuation.resume(throwing: AppErr.cast("GTLRGmail_Thread"))
}

let messages = gmailThread.messages?.compactMap { try? Message(gmailMessage: $0) } ?? []
var messages = gmailThread.messages?.compactMap { try? Message(gmailMessage: $0) } ?? []

// For trash folder: Only display deleted messages in thread
// For othr folders: Exclude deleted messages in thread
// https://github.com/FlowCrypt/flowcrypt-ios/issues/2292
let isTrashFolder = path == GeneralConstants.Gmail.trashLabelPath
messages = messages.filter { $0.labels.contains(.trash) == isTrashFolder }

let thread = MessageThread(
identifier: gmailThread.identifier,
Expand Down
Loading