fix: filter audio message attachments out of documents

pull/646/head
ryanzhao 3 years ago
parent 87a9bf9bce
commit 5b285e6bef

@ -256,11 +256,21 @@ public class MediaGalleryViewModel {
let interaction: TypedTableAlias<Interaction> = TypedTableAlias() let interaction: TypedTableAlias<Interaction> = TypedTableAlias()
let attachment: TypedTableAlias<Attachment> = TypedTableAlias() let attachment: TypedTableAlias<Attachment> = TypedTableAlias()
return SQL(""" switch (mediaType) {
\(attachment[.isVisualMedia]) = \(mediaType == .media ? true : false) AND case .media:
\(attachment[.isValid]) = true AND return SQL("""
\(interaction[.threadId]) = \(threadId) \(attachment[.isVisualMedia]) = true AND
""") \(attachment[.isValid]) = true AND
\(interaction[.threadId]) = \(threadId)
""")
case .document:
return SQL("""
\(attachment[.isVisualMedia]) = false AND
\(attachment[.isValid]) = true AND
\(attachment[.variant]) = \(Attachment.Variant.standard) AND
\(interaction[.threadId]) = \(threadId) AND
""")
}
} }
fileprivate static let galleryOrderSQL: SQL = { fileprivate static let galleryOrderSQL: SQL = {

Loading…
Cancel
Save