Skip to content

Commit

Permalink
feat: Always send proteus messages as protobuf (#13626)
Browse files Browse the repository at this point in the history
  • Loading branch information
atomrc committed Sep 8, 2022
1 parent 595f88f commit eeb3158
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
3 changes: 3 additions & 0 deletions src/script/conversation/MessageRepository.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ describe('MessageRepository', () => {
...commonSendResponse,
conversationDomain: undefined,
nativePush: true,
sendAsProtobuf: true,
payload: expect.objectContaining({
content: expect.objectContaining({hotKnock: false}),
conversation: conversation.id,
Expand Down Expand Up @@ -157,6 +158,7 @@ describe('MessageRepository', () => {
...commonSendResponse,
conversationDomain: undefined,
nativePush: true,
sendAsProtobuf: true,
payload: expect.objectContaining({
content: expect.objectContaining({text: 'new text', originalMessageId: originalMessage.id}),
conversation: conversation.id,
Expand All @@ -181,6 +183,7 @@ describe('MessageRepository', () => {
...commonSendResponse,
conversationDomain: undefined,
nativePush: true,
sendAsProtobuf: true,
payload: expect.objectContaining({
content: expect.objectContaining({text: 'hello there'}),
conversation: conversation.id,
Expand Down
8 changes: 6 additions & 2 deletions src/script/conversation/MessageRepository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -775,6 +775,7 @@ export class MessageRepository {
onSuccess: handleSuccess,
payload,
protocol: ConversationProtocol.PROTEUS,
sendAsProtobuf: true,
targetMode,
userIds: this.generateRecipients(conversation, recipients, skipSelf),
}),
Expand Down Expand Up @@ -836,8 +837,11 @@ export class MessageRepository {
conversationDomain: this.core.backendFeatures.federationEndpoints ? conversation.domain : undefined,
payload: sessionReset,
protocol: ConversationProtocol.PROTEUS,
sendAsProtobuf: true,

targetMode: MessageTargetMode.USERS_CLIENTS,
userIds: this.core.backendFeatures.federationEndpoints ? {[userId.domain]: userClient} : userClient, // we target this message to the specific client of the user (no need for mismatch handling here)
// we target this message to the specific client of the user (no need for mismatch handling here)
userIds: this.core.backendFeatures.federationEndpoints ? {[userId.domain]: userClient} : userClient,
}),
);
}
Expand Down Expand Up @@ -1092,7 +1096,7 @@ export class MessageRepository {
? this.createQualifiedRecipients(users)
: this.createRecipients(users);

this.core.service!.broadcast.broadcastGenericMessage(genericMessage, recipients, false, mismatch => {
this.core.service!.broadcast.broadcastGenericMessage(genericMessage, recipients, true, mismatch => {
this.onClientMismatch?.(mismatch);
});
};
Expand Down

0 comments on commit eeb3158

Please sign in to comment.