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

fix(search): Open a message a first time dismisses it #918

Merged
merged 1 commit into from
Aug 11, 2023
Merged
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
8 changes: 7 additions & 1 deletion MailCore/Models/Thread.swift
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,12 @@ public class Thread: Object, Decodable, Identifiable {
}

public var lastMessageFromFolder: Message? {
messages.last { $0.folderId == folder?.id }
// Search should be excluded from folderId check.
guard !fromSearch else {
return messages.last
}

return messages.last { $0.folderId == folder?.id }
}

public var formattedSubject: String {
Expand All @@ -93,6 +98,7 @@ public class Thread: Object, Decodable, Identifiable {
flagged = messages.contains { $0.flagged }
}

/// Re-generate `Thread` properties given the messages it contains.
public func recomputeOrFail() throws {
messageIds = messages.flatMap(\.linkedUids).toRealmSet()
updateUnseenMessages()
Expand Down
Loading