Add migration for call link recipient link.

This commit is contained in:
Alex Hart
2023-05-17 09:46:36 -03:00
committed by Greyson Parrelli
parent d7dd77a5af
commit 0c57113d8e
11 changed files with 185 additions and 116 deletions

View File

@@ -1294,7 +1294,7 @@ public class MessageContentProcessor {
log(envelopeTimestamp, "Synchronize call event call: " + callId);
CallTable.Call call = SignalDatabase.calls().getCallById(callId, new CallTable.CallConversationId.Peer(recipientId));
CallTable.Call call = SignalDatabase.calls().getCallById(callId, recipientId);
if (call != null) {
boolean typeMismatch = call.getType() != type;
boolean directionMismatch = call.getDirection() != direction;
@@ -1337,9 +1337,8 @@ public class MessageContentProcessor {
GroupId groupId = GroupId.push(callEvent.getConversationId().toByteArray());
RecipientId recipientId = Recipient.externalGroupExact(groupId).getId();
CallTable.CallConversationId callConversationId = new CallTable.CallConversationId.Peer(recipientId);
CallTable.Call call = SignalDatabase.calls().getCallById(callId, callConversationId);
CallTable.Call call = SignalDatabase.calls().getCallById(callId, recipientId);
if (call != null) {
if (call.getType() != type) {
warn(envelopeTimestamp, "Group/Ad-hoc call event type mismatch, ignoring. timestamp: " + timestamp + " type: " + type + " direction: " + direction + " event: " + event + " hasPeer: " + callEvent.hasConversationId());
@@ -1352,7 +1351,7 @@ public class MessageContentProcessor {
break;
case ACCEPTED:
if (call.getTimestamp() < callEvent.getTimestamp()) {
SignalDatabase.calls().setTimestamp(call.getCallId(), callConversationId, callEvent.getTimestamp());
SignalDatabase.calls().setTimestamp(call.getCallId(), recipientId, callEvent.getTimestamp());
}
if (callEvent.getDirection() == SyncMessage.CallEvent.Direction.INCOMING) {

View File

@@ -1172,7 +1172,7 @@ object SyncMessageProcessor {
log(envelopeTimestamp, "Synchronize call event call: $callId")
val call = SignalDatabase.calls.getCallById(callId, CallTable.CallConversationId.Peer(recipientId))
val call = SignalDatabase.calls.getCallById(callId, recipientId)
if (call != null) {
val typeMismatch = call.type !== type
val directionMismatch = call.direction !== direction
@@ -1209,9 +1209,8 @@ object SyncMessageProcessor {
val groupId: GroupId = GroupId.push(callEvent.conversationId.toByteArray())
val recipientId = Recipient.externalGroupExact(groupId).id
val conversationId = CallTable.CallConversationId.Peer(recipientId)
val call = SignalDatabase.calls.getCallById(callId, CallTable.CallConversationId.Peer(recipientId))
val call = SignalDatabase.calls.getCallById(callId, recipientId)
if (call != null) {
if (call.type !== type) {
@@ -1222,7 +1221,7 @@ object SyncMessageProcessor {
CallTable.Event.DELETE -> SignalDatabase.calls.deleteGroupCall(call)
CallTable.Event.ACCEPTED -> {
if (call.timestamp < callEvent.timestamp) {
SignalDatabase.calls.setTimestamp(call.callId, conversationId, callEvent.timestamp)
SignalDatabase.calls.setTimestamp(call.callId, recipientId, callEvent.timestamp)
}
if (callEvent.direction == SyncMessage.CallEvent.Direction.INCOMING) {
SignalDatabase.calls.acceptIncomingGroupCall(call)