Update a specific recipient case to merge rather than just steal PNI.
This commit is contained in:
parent
dcd0d433b0
commit
43caaf7efc
2 changed files with 15 additions and 4 deletions
|
@ -788,6 +788,17 @@ class RecipientTableTest_getAndPossiblyMerge {
|
||||||
expectChangeNumberEvent()
|
expectChangeNumberEvent()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
test("merge, e164 follows pni+aci") {
|
||||||
|
given(E164_A, PNI_A, null)
|
||||||
|
given(null, null, ACI_A)
|
||||||
|
|
||||||
|
process(null, PNI_A, ACI_A, pniVerified = true)
|
||||||
|
|
||||||
|
expect(E164_A, PNI_A, ACI_A)
|
||||||
|
expectThreadMergeEvent(E164_A)
|
||||||
|
expectPniVerified()
|
||||||
|
}
|
||||||
|
|
||||||
test("local user, local e164 and aci provided, changeSelf=false, leave e164 alone") {
|
test("local user, local e164 and aci provided, changeSelf=false, leave e164 alone") {
|
||||||
given(E164_SELF, null, ACI_SELF)
|
given(E164_SELF, null, ACI_SELF)
|
||||||
given(null, null, ACI_A)
|
given(null, null, ACI_A)
|
||||||
|
|
|
@ -2944,10 +2944,10 @@ open class RecipientTable(context: Context, databaseHelper: SignalDatabase) : Da
|
||||||
primaryId = data.byAci,
|
primaryId = data.byAci,
|
||||||
secondaryId = data.byPni
|
secondaryId = data.byPni
|
||||||
)
|
)
|
||||||
} else if (data.pniRecord.aci == null && data.pniRecord.e164 == data.e164) {
|
} else if (data.pniRecord.aci == null && (data.e164 == null || data.pniRecord.e164 == data.e164)) {
|
||||||
// The PNI record also has the E164 on it with no ACI. We're going to be stealing all of it's fields,
|
// The PNI record also has the E164 on it with no ACI. We're going to be stealing all of it's fields,
|
||||||
// so this is basically a merge with a little bit of extra prep.
|
// so this is basically a merge with a little bit of extra prep.
|
||||||
breadCrumbs += "PniRecordHasMatchingE164AndNoAci"
|
breadCrumbs += "PniRecordHasNoAci"
|
||||||
|
|
||||||
if (data.aciRecord.pni != null) {
|
if (data.aciRecord.pni != null) {
|
||||||
operations += PnpOperation.RemovePni(data.byAci)
|
operations += PnpOperation.RemovePni(data.byAci)
|
||||||
|
@ -2972,10 +2972,10 @@ open class RecipientTable(context: Context, databaseHelper: SignalDatabase) : Da
|
||||||
secondaryId = data.byPni
|
secondaryId = data.byPni
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
// The PNI record either has an ACI or a non-matching e164, meaning we need to steal what we need and leave the rest behind
|
// The PNI record has a different ACI, meaning we need to steal what we need and leave the rest behind
|
||||||
|
|
||||||
breadCrumbs += if (data.pniRecord.aci != null && data.pniRecord.e164 != data.e164) {
|
breadCrumbs += if (data.pniRecord.aci != null && data.pniRecord.e164 != data.e164) {
|
||||||
"PniRecordHasAciAndNonMatchingE164"
|
"PniRecordHasAci"
|
||||||
} else if (data.pniRecord.aci != null) {
|
} else if (data.pniRecord.aci != null) {
|
||||||
"PniRecordHasAci"
|
"PniRecordHasAci"
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Add table
Reference in a new issue