mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-19 08:09:12 +01:00
Do not allow outgoing messages when backing up release notes.
This commit is contained in:
committed by
jeffrey-signal
parent
f4c246eef0
commit
2a21fe1784
@@ -147,6 +147,10 @@ object ExportSkips {
|
||||
return log(sentTimestamp, "An incoming message author did not have an aci or e164.")
|
||||
}
|
||||
|
||||
fun outgoingMessageToReleaseNotesChat(sentTimestamp: Long): String {
|
||||
return log(sentTimestamp, "An outgoing message was sent to the release notes chat.")
|
||||
}
|
||||
|
||||
fun callWithMissingRecipient(sentTimestamp: Long): String {
|
||||
return log(sentTimestamp, "A call had a ringer with no matching exported Recipient.")
|
||||
}
|
||||
|
||||
@@ -2437,6 +2437,7 @@ class ExportState(
|
||||
val aciToRecipientId: MutableMap<String, Long> = hashMapOf()
|
||||
val recipientIdToE164: MutableMap<Long, Long> = hashMapOf()
|
||||
val customChatColorIds: MutableSet<Long> = hashSetOf()
|
||||
var releaseNoteRecipientId: Long? = null
|
||||
}
|
||||
|
||||
class ImportState(val mediaRootBackupKey: MediaRootBackupKey) {
|
||||
|
||||
@@ -1390,6 +1390,10 @@ private fun BackupMessageRecord.toRemoteSendStatus(isGroupThread: Boolean, group
|
||||
return emptyList()
|
||||
}
|
||||
|
||||
if (this.toRecipientId == exportState.releaseNoteRecipientId) {
|
||||
return emptyList()
|
||||
}
|
||||
|
||||
val statusBuilder = SendStatus.Builder()
|
||||
.recipientId(this.toRecipientId)
|
||||
.timestamp(max(this.receiptTimestamp, 0))
|
||||
@@ -1448,6 +1452,7 @@ private fun List<GroupReceiptTable.GroupReceiptInfo>?.toRemoteSendStatus(message
|
||||
|
||||
return this
|
||||
.filter { exportState.recipientIds.contains(it.recipientId.toLong()) }
|
||||
.filterNot { it.recipientId.toLong() == exportState.releaseNoteRecipientId }
|
||||
.map {
|
||||
val statusBuilder = SendStatus.Builder()
|
||||
.recipientId(it.recipientId.toLong())
|
||||
@@ -1634,6 +1639,11 @@ private fun ChatItem.validateChatItem(exportState: ExportState, selfRecipientId:
|
||||
return null
|
||||
}
|
||||
|
||||
if (this.outgoing != null && exportState.releaseNoteRecipientId != null && exportState.threadIdToRecipientId[this.chatId] == exportState.releaseNoteRecipientId) {
|
||||
Log.w(TAG, ExportSkips.outgoingMessageToReleaseNotesChat(this.dateSent))
|
||||
return null
|
||||
}
|
||||
|
||||
return this
|
||||
}
|
||||
|
||||
|
||||
@@ -44,6 +44,7 @@ object RecipientArchiveProcessor {
|
||||
if (releaseChannelId != null) {
|
||||
exportState.recipientIds.add(releaseChannelId.toLong())
|
||||
exportState.contactRecipientIds.add(releaseChannelId.toLong())
|
||||
exportState.releaseNoteRecipientId = releaseChannelId.toLong()
|
||||
emitter.emit(
|
||||
Frame(
|
||||
recipient = ArchiveRecipient(
|
||||
|
||||
Reference in New Issue
Block a user