mirror of
https://github.com/signalapp/Signal-Android.git
synced 2025-12-05 01:10:48 +00:00
Add additional validations around incoming message on export.
This commit is contained in:
committed by
Michelle Tang
parent
ea82600a83
commit
32894ff0a4
@@ -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.")
|
||||
}
|
||||
|
||||
@@ -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()
|
||||
}
|
||||
|
||||
|
||||
@@ -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")
|
||||
}
|
||||
|
||||
|
||||
@@ -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))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user