Skip to content

Commit

Permalink
Remove link preview images from shared media.
Browse files Browse the repository at this point in the history
  • Loading branch information
mtang-signal authored and cody-signal committed Apr 23, 2024
1 parent 475ca50 commit 0f4618a
Showing 1 changed file with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ class MediaTable internal constructor(context: Context?, databaseHelper: SignalD
"""
${AttachmentTable.DATA_FILE} IS NOT NULL AND
${AttachmentTable.CONTENT_TYPE} NOT LIKE 'image/svg%' AND
(${AttachmentTable.CONTENT_TYPE} LIKE 'image/%' OR ${AttachmentTable.CONTENT_TYPE} LIKE 'video/%')
(${AttachmentTable.CONTENT_TYPE} LIKE 'image/%' OR ${AttachmentTable.CONTENT_TYPE} LIKE 'video/%') AND
${MessageTable.LINK_PREVIEWS} IS NULL
"""
)

Expand All @@ -106,7 +107,8 @@ class MediaTable internal constructor(context: Context?, databaseHelper: SignalD
"""
(${AttachmentTable.DATA_FILE} IS NOT NULL OR (${AttachmentTable.CONTENT_TYPE} LIKE 'video/%' AND ${AttachmentTable.REMOTE_INCREMENTAL_DIGEST} IS NOT NULL)) AND
${AttachmentTable.CONTENT_TYPE} NOT LIKE 'image/svg%' AND
(${AttachmentTable.CONTENT_TYPE} LIKE 'image/%' OR ${AttachmentTable.CONTENT_TYPE} LIKE 'video/%')
(${AttachmentTable.CONTENT_TYPE} LIKE 'image/%' OR ${AttachmentTable.CONTENT_TYPE} LIKE 'video/%') AND
${MessageTable.LINK_PREVIEWS} IS NULL
"""
)

Expand All @@ -118,7 +120,14 @@ class MediaTable internal constructor(context: Context?, databaseHelper: SignalD
"""
)

private val ALL_MEDIA_QUERY = String.format(BASE_MEDIA_QUERY, "${AttachmentTable.DATA_FILE} IS NOT NULL AND ${AttachmentTable.CONTENT_TYPE} NOT LIKE 'text/x-signal-plain'")
private val ALL_MEDIA_QUERY = String.format(
BASE_MEDIA_QUERY,
"""
${AttachmentTable.DATA_FILE} IS NOT NULL AND
${AttachmentTable.CONTENT_TYPE} NOT LIKE 'text/x-signal-plain' AND
${MessageTable.LINK_PREVIEWS} IS NULL
"""
)

private val DOCUMENT_MEDIA_QUERY = String.format(
BASE_MEDIA_QUERY,
Expand Down

0 comments on commit 0f4618a

Please sign in to comment.