Tombstone unviewed view-once messages in remote backups
This commit is contained in:
parent
704494d902
commit
aec46306bb
@ -185,7 +185,7 @@ class BackupArchiveTSMessageContentsArchiver: BackupArchiveProtoStreamWriter {
|
||||
return archiveViewOnceMessage(
|
||||
message,
|
||||
messageRowId: messageRowId,
|
||||
context: context.recipientContext
|
||||
context: context
|
||||
)
|
||||
} else if message.isStoryReply && !message.isGroupStoryReply {
|
||||
return archiveDirectStoryReplyMessage(
|
||||
@ -792,13 +792,16 @@ class BackupArchiveTSMessageContentsArchiver: BackupArchiveProtoStreamWriter {
|
||||
private func archiveViewOnceMessage(
|
||||
_ message: TSMessage,
|
||||
messageRowId: Int64,
|
||||
context: BackupArchive.RecipientArchivingContext
|
||||
context: BackupArchive.ChatArchivingContext
|
||||
) -> ArchiveInteractionResult<ChatItemType> {
|
||||
var partialErrors = [ArchiveFrameError]()
|
||||
|
||||
var proto = BackupProto_ViewOnceMessage()
|
||||
|
||||
if !message.isViewOnceComplete {
|
||||
if
|
||||
!context.includedContentFilter.shouldTombstoneViewOnce,
|
||||
!message.isViewOnceComplete
|
||||
{
|
||||
let attachmentResult = attachmentsArchiver.archiveBodyAttachments(
|
||||
messageId: message.uniqueInteractionId,
|
||||
messageRowId: messageRowId,
|
||||
@ -827,7 +830,7 @@ class BackupArchiveTSMessageContentsArchiver: BackupArchiveProtoStreamWriter {
|
||||
let reactions: [BackupProto_Reaction]
|
||||
let reactionsResult = reactionArchiver.archiveReactions(
|
||||
message,
|
||||
context: context
|
||||
context: context.recipientContext
|
||||
)
|
||||
switch reactionsResult.bubbleUp(ChatItemType.self, partialErrors: &partialErrors) {
|
||||
case .continue(let values):
|
||||
|
||||
@ -34,6 +34,10 @@ extension BackupArchive {
|
||||
/// "lifetime" was.
|
||||
let minRemainingTimeUntilExpirationMs: UInt64
|
||||
|
||||
/// Unviewed view-once messages should be treated as viewed and
|
||||
/// tombstoned for this export.
|
||||
let shouldTombstoneViewOnce: Bool
|
||||
|
||||
/// Whether or not the plaintext SVR PIN should be included.
|
||||
let shouldIncludePin: Bool
|
||||
}
|
||||
|
||||
@ -232,6 +232,14 @@ public class BackupArchiveManagerImpl: BackupArchiveManager {
|
||||
return .dayInMs
|
||||
}
|
||||
}(),
|
||||
shouldTombstoneViewOnce: {
|
||||
switch backupPurpose {
|
||||
case .deviceTransfer:
|
||||
return false
|
||||
case .remoteBackup:
|
||||
return true
|
||||
}
|
||||
}(),
|
||||
shouldIncludePin: true
|
||||
)
|
||||
|
||||
@ -268,6 +276,7 @@ public class BackupArchiveManagerImpl: BackupArchiveManager {
|
||||
let includedContentFilter = BackupArchive.ArchivingContext.IncludedContentFilter(
|
||||
minExpirationTimeMs: 0,
|
||||
minRemainingTimeUntilExpirationMs: 0,
|
||||
shouldTombstoneViewOnce: false,
|
||||
shouldIncludePin: true
|
||||
)
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user