mirror of
https://github.com/signalapp/Signal-Server
synced 2026-04-20 05:38:04 +01:00
For ephemeral messages, remove recipient view from shared MRM data if recipient is offline
This commit is contained in:
@@ -69,6 +69,8 @@ public class MessageSender {
|
||||
|
||||
if (clientPresent) {
|
||||
messagesManager.insert(account.getUuid(), device.getId(), message.toBuilder().setEphemeral(true).build());
|
||||
} else {
|
||||
messagesManager.removeRecipientViewFromMrmData(account.getUuid(), device.getId(), message);
|
||||
}
|
||||
} else {
|
||||
messagesManager.insert(account.getUuid(), device.getId(), message);
|
||||
|
||||
@@ -462,7 +462,7 @@ public class MessagesCache extends RedisClusterPubSubAdapter<String, String> imp
|
||||
/**
|
||||
* Makes a best-effort attempt at asynchronously updating (and removing when empty) the MRM data structure
|
||||
*/
|
||||
private void removeRecipientViewFromMrmData(final List<byte[]> sharedMrmKeys, final UUID accountUuid,
|
||||
void removeRecipientViewFromMrmData(final List<byte[]> sharedMrmKeys, final UUID accountUuid,
|
||||
final byte deviceId) {
|
||||
|
||||
final Timer.Sample sample = Timer.start();
|
||||
|
||||
@@ -210,4 +210,15 @@ public class MessagesManager {
|
||||
SealedSenderMultiRecipientMessage sealedSenderMultiRecipientMessage) {
|
||||
return messagesCache.insertSharedMultiRecipientMessagePayload(UUID.randomUUID(), sealedSenderMultiRecipientMessage);
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the recipient's view from shared MRM data if necessary
|
||||
*/
|
||||
public void removeRecipientViewFromMrmData(final UUID destinationUuid, final byte destinationDeviceId,
|
||||
final Envelope message) {
|
||||
if (message.hasSharedMrmKey()) {
|
||||
messagesCache.removeRecipientViewFromMrmData(List.of(message.getSharedMrmKey().toByteArray()), destinationUuid,
|
||||
destinationDeviceId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user