Explicitly pass sync message sender device ID as an argument to sendMessage

This commit is contained in:
Jon Chambers
2025-04-10 10:17:09 -04:00
committed by Jon Chambers
parent d6bc2765b6
commit aa5fd52302
12 changed files with 167 additions and 64 deletions

View File

@@ -436,11 +436,16 @@ public class MessageController {
final Map<Byte, Integer> registrationIdsByDeviceId = messages.messages().stream()
.collect(Collectors.toMap(IncomingMessage::destinationDeviceId, IncomingMessage::destinationRegistrationId));
final Optional<Byte> syncMessageSenderDeviceId = messageType == MessageType.SYNC
? Optional.ofNullable(sender).map(authenticatedDevice -> authenticatedDevice.getAuthenticatedDevice().getId())
: Optional.empty();
try {
messageSender.sendMessages(destination,
destinationIdentifier,
messagesByDeviceId,
registrationIdsByDeviceId,
syncMessageSenderDeviceId,
userAgent);
} catch (final MismatchedDevicesException e) {
if (!e.getMismatchedDevices().staleDeviceIds().isEmpty()) {