Fix SSE event bug and make the assertion guarded by a separate flag.

This commit is contained in:
Greyson Parrelli
2023-09-21 15:55:14 -04:00
parent 76de183ec2
commit eb6394eb6a
4 changed files with 26 additions and 4 deletions

View File

@@ -1293,7 +1293,7 @@ open class MessageTable(context: Context?, databaseHelper: SignalDatabase) : Dat
}
fun insertSessionSwitchoverEvent(recipientId: RecipientId, threadId: Long, event: SessionSwitchoverEvent) {
check(FeatureFlags.phoneNumberPrivacy()) { "Should not occur in a non-PNP world!" }
check(!FeatureFlags.blockSessionSwitchoverEvents()) { "Should not occur in a non-PNP world!" }
writableDatabase
.insertInto(TABLE_NAME)
.values(

View File

@@ -2650,7 +2650,7 @@ open class RecipientTable(context: Context, databaseHelper: SignalDatabase) : Da
* records and turning it into a possible event.
*/
private fun sessionSwitchoverEventIfNeeded(pniVerified: Boolean, oldRecord: RecipientRecord?, newRecord: RecipientRecord?): PnpOperation? {
return if (oldRecord != null && newRecord != null && needsSessionSwitchoverEvent(pniVerified, oldRecord.serviceId, newRecord.serviceId)) {
return if (oldRecord != null && newRecord != null && oldRecord.serviceId == oldRecord.pni && newRecord.serviceId == newRecord.aci && needsSessionSwitchoverEvent(pniVerified, oldRecord.serviceId, newRecord.serviceId)) {
PnpOperation.SessionSwitchoverInsert(
recipientId = newRecord.id,
e164 = newRecord.e164