Fix release channel recipient ID surviving failed backup imports.

This commit is contained in:
Cody Henthorne
2026-03-05 11:46:38 -05:00
committed by jeffrey-signal
parent 2356bb6da2
commit 5b543c5212
6 changed files with 79 additions and 16 deletions

View File

@@ -194,9 +194,10 @@ public class ApplicationMigrations {
static final int SVR2_ENCLAVE_UPDATE_5 = 150;
static final int STICKER_PACK_ADDITION_2 = 151;
static final int DELETED_BY_DB_MIGRATION = 152;
static final int RELEASE_CHANNEL_RECIPIENT_FIX = 153;
}
public static final int CURRENT_VERSION = 152;
public static final int CURRENT_VERSION = 153;
/**
* This *must* be called after the {@link JobManager} has been instantiated, but *before* the call
@@ -899,6 +900,10 @@ public class ApplicationMigrations {
jobs.put(Version.DELETED_BY_DB_MIGRATION, new DatabaseMigrationJob());
}
if (lastSeenVersion < Version.RELEASE_CHANNEL_RECIPIENT_FIX) {
jobs.put(Version.RELEASE_CHANNEL_RECIPIENT_FIX, new ReleaseChannelRecipientFixMigrationJob());
}
return jobs;
}

View File

@@ -0,0 +1,38 @@
/*
* Copyright 2025 Signal Messenger, LLC
* SPDX-License-Identifier: AGPL-3.0-only
*/
package org.thoughtcrime.securesms.migrations
import org.thoughtcrime.securesms.dependencies.AppDependencies
import org.thoughtcrime.securesms.jobmanager.Job
import org.thoughtcrime.securesms.jobs.CreateReleaseChannelJob
/**
* In a failed backup flow, the release channel recipient can be incorrectly set. Fix it if that's the case.
*/
internal class ReleaseChannelRecipientFixMigrationJob private constructor(parameters: Parameters) : MigrationJob(parameters) {
companion object {
const val KEY = "ReleaseChannelRecipientFixMigrationJob"
}
constructor() : this(Parameters.Builder().build())
override fun isUiBlocking(): Boolean = false
override fun getFactoryKey(): String = KEY
override fun performMigration() {
AppDependencies.jobManager.add(CreateReleaseChannelJob.create())
}
override fun shouldRetry(e: Exception): Boolean = false
class Factory : Job.Factory<ReleaseChannelRecipientFixMigrationJob> {
override fun create(parameters: Parameters, serializedData: ByteArray?): ReleaseChannelRecipientFixMigrationJob {
return ReleaseChannelRecipientFixMigrationJob(parameters)
}
}
}