mirror of
https://github.com/signalapp/Signal-Android.git
synced 2025-12-23 12:38:33 +00:00
Be more lenient with quality matches when forwarding attachments.
This commit is contained in:
committed by
Cody Henthorne
parent
7d5627b17b
commit
d7ee9639fd
@@ -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.
|
// 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 {
|
test {
|
||||||
val id1 = insertWithData(DATA_A, TransformProperties(sentMediaQuality = SentMediaQuality.HIGH.code))
|
val id1 = insertWithData(DATA_A, TransformProperties(sentMediaQuality = SentMediaQuality.HIGH.code))
|
||||||
compress(id1, DATA_A_COMPRESSED)
|
compress(id1, DATA_A_COMPRESSED)
|
||||||
@@ -337,10 +337,11 @@ class AttachmentTableTest_deduping {
|
|||||||
|
|
||||||
val id2 = insertWithData(DATA_A_COMPRESSED, TransformProperties(sentMediaQuality = SentMediaQuality.STANDARD.code))
|
val id2 = insertWithData(DATA_A_COMPRESSED, TransformProperties(sentMediaQuality = SentMediaQuality.STANDARD.code))
|
||||||
|
|
||||||
assertDataFilesAreDifferent(id1, id2)
|
assertDataFilesAreTheSame(id1, id2)
|
||||||
|
assertDataHashEndMatches(id1, id2)
|
||||||
assertSkipTransform(id1, true)
|
assertSkipTransform(id1, true)
|
||||||
assertSkipTransform(id2, false)
|
assertSkipTransform(id1, true)
|
||||||
assertDoesNotHaveRemoteFields(id2)
|
assertRemoteFieldsMatch(id1, id2)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make sure that files marked as unhashable are all updated together
|
// Make sure that files marked as unhashable are all updated together
|
||||||
|
|||||||
@@ -1297,11 +1297,8 @@ class AttachmentTable(
|
|||||||
return false
|
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
|
return true
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (newProperties.sentMediaQuality != potentialMatchProperties.sentMediaQuality) {
|
if (newProperties.sentMediaQuality != potentialMatchProperties.sentMediaQuality) {
|
||||||
return false
|
return false
|
||||||
|
|||||||
Reference in New Issue
Block a user