Skip to content

Commit

Permalink
fix: deleted message still visible in thread issue (#2297)
Browse files Browse the repository at this point in the history
  • Loading branch information
ioanmo226 authored Jul 26, 2023
1 parent b907686 commit af025fe
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
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

0 comments on commit af025fe

Please sign in to comment.