mirror of
https://github.com/signalapp/Signal-Server
synced 2026-04-21 02:08:03 +01:00
Assume that PNI registration IDs are always present on Device records
This commit is contained in:
committed by
Jon Chambers
parent
93ba6616d1
commit
13fc0ffbca
@@ -383,7 +383,7 @@ public class KeysController {
|
||||
if (signedEcPreKey != null || unsignedEcPreKey != null || pqPreKey != null) {
|
||||
final int registrationId = switch (targetIdentifier.identityType()) {
|
||||
case ACI -> device.getRegistrationId();
|
||||
case PNI -> device.getPhoneNumberIdentityRegistrationId().orElse(device.getRegistrationId());
|
||||
case PNI -> device.getPhoneNumberIdentityRegistrationId();
|
||||
};
|
||||
|
||||
responseItems.add(
|
||||
|
||||
@@ -321,7 +321,7 @@ public class MessageSender {
|
||||
|
||||
final int expectedRegistrationId = switch (serviceIdentifier.identityType()) {
|
||||
case ACI -> device.getRegistrationId();
|
||||
case PNI -> device.getPhoneNumberIdentityRegistrationId().orElseGet(device::getRegistrationId);
|
||||
case PNI -> device.getPhoneNumberIdentityRegistrationId();
|
||||
};
|
||||
|
||||
return registrationId != expectedRegistrationId;
|
||||
|
||||
@@ -63,7 +63,7 @@ public class ReceiptSender {
|
||||
final Map<Byte, Integer> registrationIdsByDeviceId = destinationAccount.getDevices().stream()
|
||||
.collect(Collectors.toMap(Device::getId, device -> switch (destinationIdentifier.identityType()) {
|
||||
case ACI -> device.getRegistrationId();
|
||||
case PNI -> device.getPhoneNumberIdentityRegistrationId().orElseGet(device::getRegistrationId);
|
||||
case PNI -> device.getPhoneNumberIdentityRegistrationId();
|
||||
}));
|
||||
|
||||
try {
|
||||
|
||||
@@ -64,9 +64,8 @@ public class Device {
|
||||
@JsonProperty
|
||||
private int registrationId;
|
||||
|
||||
@Nullable
|
||||
@JsonProperty("pniRegistrationId")
|
||||
private Integer phoneNumberIdentityRegistrationId;
|
||||
private int phoneNumberIdentityRegistrationId;
|
||||
|
||||
@JsonProperty
|
||||
private long lastSeen;
|
||||
@@ -216,8 +215,8 @@ public class Device {
|
||||
this.registrationId = registrationId;
|
||||
}
|
||||
|
||||
public OptionalInt getPhoneNumberIdentityRegistrationId() {
|
||||
return phoneNumberIdentityRegistrationId != null ? OptionalInt.of(phoneNumberIdentityRegistrationId) : OptionalInt.empty();
|
||||
public int getPhoneNumberIdentityRegistrationId() {
|
||||
return phoneNumberIdentityRegistrationId;
|
||||
}
|
||||
|
||||
public void setPhoneNumberIdentityRegistrationId(final int phoneNumberIdentityRegistrationId) {
|
||||
|
||||
Reference in New Issue
Block a user