Merge pull request #791 from mpretty-cyro/feature/pin-note-to-self-in-share-extension

Update the share extension to always show 'Note to Self' first
This commit is contained in:
Morgan Pretty 2023-02-20 08:45:56 +11:00 committed by GitHub
commit e0f9be082a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1607,15 +1607,14 @@ public extension SessionThreadViewModel {
\(SQL("\(thread[.variant]) != \(SessionThread.Variant.contact)")) OR
\(SQL("\(thread[.id]) = \(userPublicKey)")) OR
\(contact[.isApproved]) = true
) AND (
-- Only show the 'Note to Self' thread if it has an interaction
\(SQL("\(thread[.id]) != \(userPublicKey)")) OR
\(interaction[.id]) IS NOT NULL
)
-- Always show the 'Note to Self' thread when sharing
OR \(SQL("\(thread[.id]) = \(userPublicKey)"))
)
GROUP BY \(thread[.id])
ORDER BY IFNULL(\(interaction[.timestampMs]), (\(thread[.creationDateTimestamp]) * 1000)) DESC
-- 'Note to Self', then by most recent message
ORDER BY \(SQL("\(thread[.id]) = \(userPublicKey)")) DESC, IFNULL(\(interaction[.timestampMs]), (\(thread[.creationDateTimestamp]) * 1000)) DESC
"""
return request.adapted { db in