Fix corner case in story distribution list syncing.

fork-5.53.8
Greyson Parrelli 2022-04-14 10:13:11 -04:00
rodzic 9ceb5b2e85
commit 8da66bc789
2 zmienionych plików z 5 dodań i 2 usunięć

Wyświetl plik

@ -85,6 +85,7 @@ import org.thoughtcrime.securesms.storage.StorageRecordUpdate
import org.thoughtcrime.securesms.storage.StorageSyncHelper import org.thoughtcrime.securesms.storage.StorageSyncHelper
import org.thoughtcrime.securesms.storage.StorageSyncModels import org.thoughtcrime.securesms.storage.StorageSyncModels
import org.thoughtcrime.securesms.util.Base64 import org.thoughtcrime.securesms.util.Base64
import org.thoughtcrime.securesms.util.FeatureFlags
import org.thoughtcrime.securesms.util.GroupUtil import org.thoughtcrime.securesms.util.GroupUtil
import org.thoughtcrime.securesms.util.IdentityUtil import org.thoughtcrime.securesms.util.IdentityUtil
import org.thoughtcrime.securesms.util.ProfileUtil import org.thoughtcrime.securesms.util.ProfileUtil
@ -1093,7 +1094,7 @@ open class RecipientDatabase(context: Context, databaseHelper: SignalDatabase) :
* @return All storage IDs for synced records, excluding the ones that need to be deleted. * @return All storage IDs for synced records, excluding the ones that need to be deleted.
*/ */
fun getContactStorageSyncIdsMap(): Map<RecipientId, StorageId> { fun getContactStorageSyncIdsMap(): Map<RecipientId, StorageId> {
val (inPart, args) = if (Recipient.self().storiesCapability == Recipient.Capability.SUPPORTED) { val (inPart, args) = if (FeatureFlags.stories() && Recipient.self().storiesCapability == Recipient.Capability.SUPPORTED) {
"(?, ?)" to SqlUtil.buildArgs(GroupType.NONE.id, Recipient.self().id, GroupType.SIGNAL_V1.id, GroupType.DISTRIBUTION_LIST.id) "(?, ?)" to SqlUtil.buildArgs(GroupType.NONE.id, Recipient.self().id, GroupType.SIGNAL_V1.id, GroupType.DISTRIBUTION_LIST.id)
} else { } else {
"(?)" to SqlUtil.buildArgs(GroupType.NONE.id, Recipient.self().id, GroupType.SIGNAL_V1.id) "(?)" to SqlUtil.buildArgs(GroupType.NONE.id, Recipient.self().id, GroupType.SIGNAL_V1.id)

Wyświetl plik

@ -448,8 +448,10 @@ public class StorageSyncJob extends BaseJob {
if (record.getDistributionListId() != null) { if (record.getDistributionListId() != null) {
records.add(StorageSyncModels.localToRemoteRecord(record)); records.add(StorageSyncModels.localToRemoteRecord(record));
} else { } else {
throw new MissingRecipientModelError("Missing local recipient model! Type: " + id.getType()); throw new MissingRecipientModelError("Missing local recipient model (no DistributionListId)! Type: " + id.getType());
} }
} else {
throw new MissingRecipientModelError("Missing local recipient model! Type: " + id.getType());
} }
break; break;
default: default: