mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-02-14 23:18:43 +00:00
Fix validation errors around group chat updates.
This commit is contained in:
committed by
jeffrey-signal
parent
1da75018eb
commit
e7bfefa027
@@ -143,6 +143,10 @@ object ExportSkips {
|
||||
return log(sentTimestamp, "A chat update that only makes sense for individual chats was found in a different kind of chat.")
|
||||
}
|
||||
|
||||
fun groupChatUpdateInWrongTypeOfChat(sentTimestamp: Long): String {
|
||||
return log(sentTimestamp, "A chat update that only makes sense for group chats was found in a different kind of chat.")
|
||||
}
|
||||
|
||||
fun individualChatUpdateNotAuthoredBySelf(sentTimestamp: Long): String {
|
||||
return log(sentTimestamp, "A chat update that only makes sense to be authored by self has a different author.")
|
||||
}
|
||||
|
||||
@@ -1667,6 +1667,11 @@ private fun ChatItem.validateChatItem(exportState: ExportState, selfRecipientId:
|
||||
return null
|
||||
}
|
||||
|
||||
if (this.updateMessage != null && this.updateMessage.isOnlyForGroupChats() && exportState.threadIdToRecipientId[this.chatId] !in exportState.groupRecipientIds) {
|
||||
Log.w(TAG, ExportSkips.groupChatUpdateInWrongTypeOfChat(this.dateSent))
|
||||
return null
|
||||
}
|
||||
|
||||
if (this.updateMessage != null && this.updateMessage.canOnlyBeAuthoredBySelf() && this.authorId != selfRecipientId.toLong()) {
|
||||
Log.w(TAG, ExportSkips.individualChatUpdateNotAuthoredBySelf(this.dateSent))
|
||||
return null
|
||||
@@ -1693,6 +1698,10 @@ private fun ChatUpdateMessage.isOnlyForIndividualChats(): Boolean {
|
||||
this.simpleUpdate?.type == SimpleChatUpdate.Type.PAYMENTS_ACTIVATED
|
||||
}
|
||||
|
||||
private fun ChatUpdateMessage.isOnlyForGroupChats(): Boolean {
|
||||
return this.groupChange != null
|
||||
}
|
||||
|
||||
private fun ChatUpdateMessage.canOnlyBeAuthoredBySelf(): Boolean {
|
||||
return this.simpleUpdate?.type == SimpleChatUpdate.Type.REPORTED_SPAM ||
|
||||
this.simpleUpdate?.type == SimpleChatUpdate.Type.MESSAGE_REQUEST_ACCEPTED ||
|
||||
|
||||
Reference in New Issue
Block a user