mirror of
https://github.com/signalapp/Signal-Android.git
synced 2025-12-23 04:28:35 +00:00
Fix incorrect local group state bug.
This commit is contained in:
committed by
Nicholas Tinsley
parent
37815a3f39
commit
a66857a7cc
@@ -94,6 +94,7 @@ import org.thoughtcrime.securesms.database.helpers.migration.V233_FixInAppPaymen
|
||||
import org.thoughtcrime.securesms.database.helpers.migration.V234_ThumbnailRestoreStateColumn
|
||||
import org.thoughtcrime.securesms.database.helpers.migration.V235_AttachmentUuidColumn
|
||||
import org.thoughtcrime.securesms.database.helpers.migration.V236_FixInAppSubscriberCurrencyIfAble
|
||||
import org.thoughtcrime.securesms.database.helpers.migration.V237_ResetGroupForceUpdateTimestamps
|
||||
|
||||
/**
|
||||
* Contains all of the database migrations for [SignalDatabase]. Broken into a separate file for cleanliness.
|
||||
@@ -190,10 +191,11 @@ object SignalDatabaseMigrations {
|
||||
233 to V233_FixInAppPaymentTableDefaultNotifiedValue,
|
||||
234 to V234_ThumbnailRestoreStateColumn,
|
||||
235 to V235_AttachmentUuidColumn,
|
||||
236 to V236_FixInAppSubscriberCurrencyIfAble
|
||||
236 to V236_FixInAppSubscriberCurrencyIfAble,
|
||||
237 to V237_ResetGroupForceUpdateTimestamps
|
||||
)
|
||||
|
||||
const val DATABASE_VERSION = 236
|
||||
const val DATABASE_VERSION = 237
|
||||
|
||||
@JvmStatic
|
||||
fun migrate(context: Application, db: SQLiteDatabase, oldVersion: Int, newVersion: Int) {
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
/*
|
||||
* Copyright 2024 Signal Messenger, LLC
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
package org.thoughtcrime.securesms.database.helpers.migration
|
||||
|
||||
import android.app.Application
|
||||
import net.zetetic.database.sqlcipher.SQLiteDatabase
|
||||
|
||||
/**
|
||||
* Reset last forced update timestamp for groups to fix a local group state bug.
|
||||
*/
|
||||
@Suppress("ClassName")
|
||||
object V237_ResetGroupForceUpdateTimestamps : SignalDatabaseMigration {
|
||||
override fun migrate(context: Application, db: SQLiteDatabase, oldVersion: Int, newVersion: Int) {
|
||||
db.execSQL("UPDATE groups SET last_force_update_timestamp = 0")
|
||||
}
|
||||
}
|
||||
@@ -158,7 +158,7 @@ class GroupsV2StateProcessor private constructor(
|
||||
when (serverUpdateResult) {
|
||||
InternalUpdateResult.NoUpdateNeeded -> return GroupUpdateResult.CONSISTENT_OR_AHEAD
|
||||
is InternalUpdateResult.Updated -> return GroupUpdateResult.updated(serverUpdateResult.updatedLocalState)
|
||||
is InternalUpdateResult.UpdateFailed,
|
||||
is InternalUpdateResult.UpdateFailed -> throw serverUpdateResult.throwable
|
||||
is InternalUpdateResult.NotAMember -> Unit
|
||||
}
|
||||
|
||||
@@ -184,11 +184,7 @@ class GroupsV2StateProcessor private constructor(
|
||||
profileAndMessageHelper.leaveGroupLocally(serviceIds)
|
||||
}
|
||||
|
||||
throw when (serverUpdateResult) {
|
||||
is InternalUpdateResult.NotAMember -> GroupNotAMemberException(serverUpdateResult.exception)
|
||||
is InternalUpdateResult.UpdateFailed -> throw serverUpdateResult.throwable
|
||||
else -> AssertionError("Should not reach here with ${serverUpdateResult::class.java.simpleName}")
|
||||
}
|
||||
throw GroupNotAMemberException(serverUpdateResult.exception)
|
||||
}
|
||||
|
||||
private fun canApplyP2pChange(
|
||||
|
||||
@@ -2921,7 +2921,7 @@ public class PushServiceSocket {
|
||||
GROUPSV2_JOINED_AT,
|
||||
"GET",
|
||||
null,
|
||||
NO_HANDLER))
|
||||
GROUPS_V2_GET_CURRENT_HANDLER))
|
||||
{
|
||||
return Member.ADAPTER.decode(readBodyBytes(response)).joinedAtRevision;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user