Add additional validations around incoming message on export.

This commit is contained in:
Greyson Parrelli
2025-10-30 16:22:05 -04:00
committed by Michelle Tang
parent ea82600a83
commit 32894ff0a4
4 changed files with 16 additions and 4 deletions

View File

@@ -139,6 +139,14 @@ object ExportSkips {
return log(sentTimestamp, "A chat update that only makes sense for individual 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.")
}
fun incomingMessageAuthorDoesNotHaveAciOrE164(sentTimestamp: Long): String {
return log(sentTimestamp, "An incoming message author did not have an aci or e164.")
}
fun callWithMissingRecipient(sentTimestamp: Long): String {
return log(sentTimestamp, "A call had a ringer with no matching exported Recipient.")
}

View File

@@ -2429,6 +2429,7 @@ class ExportState(
val threadIdToRecipientId: MutableMap<Long, Long> = hashMapOf()
val recipientIdToAci: MutableMap<Long, ByteString> = hashMapOf()
val aciToRecipientId: MutableMap<String, Long> = hashMapOf()
val recipientIdToE164: MutableMap<Long, Long> = hashMapOf()
val customChatColorIds: MutableSet<Long> = hashSetOf()
}

View File

@@ -265,22 +265,22 @@ class ChatItemArchiveExporter(
}
MessageTypes.isReportedSpam(record.type) -> {
builder.updateMessage = simpleUpdate(SimpleChatUpdate.Type.REPORTED_SPAM).takeIf { builder.authorId == selfRecipientId.toLong() }
builder.updateMessage = simpleUpdate(SimpleChatUpdate.Type.REPORTED_SPAM)
transformTimer.emit("simple-update")
}
MessageTypes.isMessageRequestAccepted(record.type) -> {
builder.updateMessage = simpleUpdate(SimpleChatUpdate.Type.MESSAGE_REQUEST_ACCEPTED).takeIf { builder.authorId == selfRecipientId.toLong() }
builder.updateMessage = simpleUpdate(SimpleChatUpdate.Type.MESSAGE_REQUEST_ACCEPTED)
transformTimer.emit("simple-update")
}
MessageTypes.isBlocked(record.type) -> {
builder.updateMessage = simpleUpdate(SimpleChatUpdate.Type.BLOCKED).takeIf { builder.authorId == selfRecipientId.toLong() }
builder.updateMessage = simpleUpdate(SimpleChatUpdate.Type.BLOCKED)
transformTimer.emit("simple-update")
}
MessageTypes.isUnblocked(record.type) -> {
builder.updateMessage = simpleUpdate(SimpleChatUpdate.Type.UNBLOCKED).takeIf { builder.authorId == selfRecipientId.toLong() }
builder.updateMessage = simpleUpdate(SimpleChatUpdate.Type.UNBLOCKED)
transformTimer.emit("simple-update")
}

View File

@@ -68,6 +68,9 @@ object RecipientArchiveProcessor {
exportState.recipientIdToAci[recipient.id] = it
exportState.aciToRecipientId[ServiceId.ACI.parseOrThrow(it).toString()] = recipient.id
}
recipient.contact?.e164?.let {
exportState.recipientIdToE164[recipient.id] = it
}
emitter.emit(Frame(recipient = recipient))
}