mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-02 00:17:41 +01:00
Filter out revisions with mismatched authors during backup export.
This commit is contained in:
committed by
Alex Hart
parent
72d75e9cd5
commit
3d2c51c14b
@@ -194,6 +194,10 @@ object ExportOddities {
|
||||
return log(sentTimestamp, "Revisions for this message contained items of a different type than the parent item. Ignoring mismatched revisions.")
|
||||
}
|
||||
|
||||
fun mismatchedRevisionAuthor(sentTimestamp: Long): String {
|
||||
return log(sentTimestamp, "Revisions for this message contained items with a different author than the parent item. Ignoring mismatched revisions.")
|
||||
}
|
||||
|
||||
fun outgoingMessageWasSentButTimerNotStarted(sentTimestamp: Long): String {
|
||||
return log(sentTimestamp, "Outgoing expiring message was sent, but the timer wasn't started. Setting expireStartDate to dateReceived.")
|
||||
}
|
||||
|
||||
@@ -1741,19 +1741,24 @@ private fun ChatUpdateMessage.canOnlyBeAuthoredBySelf(): Boolean {
|
||||
}
|
||||
|
||||
private fun List<ChatItem>.repairRevisions(current: ChatItem.Builder): List<ChatItem> {
|
||||
val authorFiltered = this.filter { it.authorId == current.authorId }
|
||||
if (authorFiltered.size != this.size) {
|
||||
Log.w(TAG, ExportOddities.mismatchedRevisionAuthor(current.dateSent))
|
||||
}
|
||||
|
||||
return if (current.standardMessage != null) {
|
||||
val filtered = this
|
||||
val filtered = authorFiltered
|
||||
.filter { it.standardMessage != null }
|
||||
.map { it.withDowngradeVoiceNotes() }
|
||||
|
||||
if (this.size != filtered.size) {
|
||||
if (authorFiltered.size != filtered.size) {
|
||||
Log.w(TAG, ExportOddities.mismatchedRevisionHistory(current.dateSent))
|
||||
}
|
||||
|
||||
filtered
|
||||
} else if (current.directStoryReplyMessage != null) {
|
||||
val filtered = this.filter { it.directStoryReplyMessage != null }
|
||||
if (this.size != filtered.size) {
|
||||
val filtered = authorFiltered.filter { it.directStoryReplyMessage != null }
|
||||
if (authorFiltered.size != filtered.size) {
|
||||
Log.w(TAG, ExportOddities.mismatchedRevisionHistory(current.dateSent))
|
||||
}
|
||||
filtered
|
||||
|
||||
Reference in New Issue
Block a user