mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-08-14 09:13:42 +01:00
Prevent accepted group message request from resetting when restored from storage.
This commit is contained in:
+23
@@ -142,6 +142,8 @@ class GroupsV2StateProcessorTest {
|
||||
mockkObject(ProfileAndMessageHelper)
|
||||
every { ProfileAndMessageHelper.create(any(), any(), any()) } returns profileAndMessageHelper
|
||||
|
||||
every { recipientTable.isProfileSharing(groupId) } answers { false }
|
||||
|
||||
every { groupsV2Operations.forGroup(secretParams) } answers { callOriginal() }
|
||||
|
||||
processor = GroupsV2StateProcessor.forGroup(serviceIds, masterKey, secretParams)
|
||||
@@ -1462,4 +1464,25 @@ class GroupsV2StateProcessorTest {
|
||||
verify { groupTable.create(masterKey, result.latestServer!!, null, null) }
|
||||
verify(exactly = 0) { recipientTable.rotateStorageId(any()) }
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `when group already has profile sharing enabled, then setProfileSharing does not re-derive it from membership`() {
|
||||
val joinedAtRevision = 1
|
||||
val newLocalState = DecryptedGroup(
|
||||
revision = joinedAtRevision,
|
||||
members = listOf(member(otherAci), member(selfAci, joinedAt = joinedAtRevision))
|
||||
)
|
||||
val addedByOtherChange = DecryptedGroupChange(
|
||||
revision = joinedAtRevision,
|
||||
editorServiceIdBytes = otherAci.toByteString()
|
||||
)
|
||||
val groupStateDiff = GroupStateDiff(previousGroupState = null, changedGroupState = newLocalState, change = addedByOtherChange)
|
||||
|
||||
every { recipientTable.isProfileSharing(groupId) } answers { true }
|
||||
|
||||
profileAndMessageHelper.setProfileSharing(groupStateDiff, newLocalState, needsAvatarFetch = true)
|
||||
|
||||
verify { recipientTable.isProfileSharing(groupId) }
|
||||
verify(exactly = 0) { recipientTable.setProfileSharing(any(), any()) }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user