Be more lenient with quality matches when forwarding attachments.

This commit is contained in:
Greyson Parrelli
2024-03-18 20:55:26 -04:00
committed by Cody Henthorne
parent 7d5627b17b
commit d7ee9639fd
2 changed files with 6 additions and 8 deletions

View File

@@ -329,7 +329,7 @@ class AttachmentTableTest_deduping {
}
// This represents what would happen if you sent an image using high quality, then forwarded it using standard quality.
// Lowering the quality would change the output, so we shouldn't dedupe.
// Since you're forwarding, it doesn't matter if the new thing has a lower quality, we should still match and skip transform.
test {
val id1 = insertWithData(DATA_A, TransformProperties(sentMediaQuality = SentMediaQuality.HIGH.code))
compress(id1, DATA_A_COMPRESSED)
@@ -337,10 +337,11 @@ class AttachmentTableTest_deduping {
val id2 = insertWithData(DATA_A_COMPRESSED, TransformProperties(sentMediaQuality = SentMediaQuality.STANDARD.code))
assertDataFilesAreDifferent(id1, id2)
assertDataFilesAreTheSame(id1, id2)
assertDataHashEndMatches(id1, id2)
assertSkipTransform(id1, true)
assertSkipTransform(id2, false)
assertDoesNotHaveRemoteFields(id2)
assertSkipTransform(id1, true)
assertRemoteFieldsMatch(id1, id2)
}
// Make sure that files marked as unhashable are all updated together

View File

@@ -1297,11 +1297,8 @@ class AttachmentTable(
return false
}
// If the potential match was sent using standard quality, we can re-use the file -- the new thing being high-quality can't make it any nicer
if (potentialMatchProperties.sentMediaQuality == SentMediaQuality.STANDARD.code) {
return true
}
}
if (newProperties.sentMediaQuality != potentialMatchProperties.sentMediaQuality) {
return false