From 173b49723baa594d246c10d820d18da985257a3d Mon Sep 17 00:00:00 2001 From: Audric Ackermann Date: Thu, 10 Jun 2021 09:08:20 +1000 Subject: [PATCH] rename groupInvitation in proto and remove more stuff unused --- protos/SignalService.proto | 47 ++----------------- ts/receiver/closedGroups.ts | 2 - ts/receiver/contentMessage.ts | 3 +- ts/receiver/dataMessage.ts | 5 +- .../visibleMessage/GroupInvitationMessage.ts | 8 ++-- .../messages/GroupInvitationMessage_test.ts | 4 +- 6 files changed, 14 insertions(+), 55 deletions(-) diff --git a/protos/SignalService.proto b/protos/SignalService.proto index 88e861568..a1f83950c 100644 --- a/protos/SignalService.proto +++ b/protos/SignalService.proto @@ -94,6 +94,10 @@ message DataMessage { optional string profilePicture = 2; } + message OpenGroupInvitation { + optional string url = 1; + optional string name = 3; + } message ClosedGroupControlMessage { @@ -127,10 +131,6 @@ message DataMessage { optional uint32 expireTimer = 8; } - message GroupInvitation { - optional string serverAddress = 1; - optional string serverName = 3; - } optional string body = 1; repeated AttachmentPointer attachments = 2; @@ -140,10 +140,9 @@ message DataMessage { optional bytes profileKey = 6; optional uint64 timestamp = 7; optional Quote quote = 8; - repeated Contact contact = 9; repeated Preview preview = 10; optional LokiProfile profile = 101; - optional GroupInvitation groupInvitation = 102; + optional OpenGroupInvitation openGroupInvitation = 102; optional ClosedGroupControlMessage closedGroupControlMessage = 104; optional string syncTarget = 105; } @@ -226,39 +225,3 @@ message GroupContext { repeated string admins = 6; } -message ContactDetails { - - message Avatar { - optional string contentType = 1; - optional uint32 length = 2; - } - - // @required - optional string number = 1; - optional string name = 2; - optional Avatar avatar = 3; - optional string color = 4; - optional bytes profileKey = 6; - optional bool blocked = 7; - optional uint32 expireTimer = 8; - optional string nickname = 101; -} - -message GroupDetails { - - message Avatar { - optional string contentType = 1; - optional uint32 length = 2; - } - - // @required - optional bytes id = 1; - optional string name = 2; - repeated string members = 3; - optional Avatar avatar = 4; - optional bool active = 5 [default = true]; - optional uint32 expireTimer = 6; - optional string color = 7; - optional bool blocked = 8; - repeated string admins = 9; -} diff --git a/ts/receiver/closedGroups.ts b/ts/receiver/closedGroups.ts index aa42254d5..a90ded05b 100644 --- a/ts/receiver/closedGroups.ts +++ b/ts/receiver/closedGroups.ts @@ -186,8 +186,6 @@ export async function handleNewClosedGroup( await removeFromCache(envelope); return; } - // FIXME maybe we should handle an expiretimer here too? And on ClosedGroup updates? - const maybeConvo = ConversationController.getInstance().get(groupId); const expireTimer = groupUpdate.expireTimer; diff --git a/ts/receiver/contentMessage.ts b/ts/receiver/contentMessage.ts index c2c73ecbb..a1f669008 100644 --- a/ts/receiver/contentMessage.ts +++ b/ts/receiver/contentMessage.ts @@ -297,10 +297,9 @@ function shouldDropBlockedUserMessage(content: SignalService.Content): boolean { const data = content.dataMessage; const isControlDataMessageOnly = !data.body && - !data.contact?.length && !data.preview?.length && !data.attachments?.length && - !data.groupInvitation && + !data.openGroupInvitation && !data.quote; return !isControlDataMessageOnly; diff --git a/ts/receiver/dataMessage.ts b/ts/receiver/dataMessage.ts index 7bb4f6830..062ce4615 100644 --- a/ts/receiver/dataMessage.ts +++ b/ts/receiver/dataMessage.ts @@ -249,7 +249,7 @@ export async function processDecrypted( } export function isMessageEmpty(message: SignalService.DataMessage) { - const { flags, body, attachments, group, quote, contact, preview, groupInvitation } = message; + const { flags, body, attachments, group, quote, preview, openGroupInvitation } = message; return ( !flags && @@ -258,9 +258,8 @@ export function isMessageEmpty(message: SignalService.DataMessage) { _.isEmpty(attachments) && _.isEmpty(group) && _.isEmpty(quote) && - _.isEmpty(contact) && _.isEmpty(preview) && - _.isEmpty(groupInvitation) + _.isEmpty(openGroupInvitation) ); } diff --git a/ts/session/messages/outgoing/visibleMessage/GroupInvitationMessage.ts b/ts/session/messages/outgoing/visibleMessage/GroupInvitationMessage.ts index 2ff3bef36..1140fe72f 100644 --- a/ts/session/messages/outgoing/visibleMessage/GroupInvitationMessage.ts +++ b/ts/session/messages/outgoing/visibleMessage/GroupInvitationMessage.ts @@ -24,13 +24,13 @@ export class GroupInvitationMessage extends DataMessage { } public dataProto(): SignalService.DataMessage { - const groupInvitation = new SignalService.DataMessage.GroupInvitation({ - serverAddress: this.serverAddress, - serverName: this.serverName, + const openGroupInvitation = new SignalService.DataMessage.OpenGroupInvitation({ + url: this.serverAddress, + name: this.serverName, }); return new SignalService.DataMessage({ - groupInvitation, + openGroupInvitation, expireTimer: this.expireTimer, }); } diff --git a/ts/test/session/unit/messages/GroupInvitationMessage_test.ts b/ts/test/session/unit/messages/GroupInvitationMessage_test.ts index 13c83c963..fb4689180 100644 --- a/ts/test/session/unit/messages/GroupInvitationMessage_test.ts +++ b/ts/test/session/unit/messages/GroupInvitationMessage_test.ts @@ -23,8 +23,8 @@ describe('GroupInvitationMessage', () => { const plainText = message.plainTextBuffer(); const decoded = SignalService.Content.decode(plainText); - expect(decoded.dataMessage?.groupInvitation).to.have.property('serverAddress', serverAddress); - expect(decoded.dataMessage?.groupInvitation).to.have.property('serverName', serverName); + expect(decoded.dataMessage?.openGroupInvitation).to.have.property('url', serverAddress); + expect(decoded.dataMessage?.openGroupInvitation).to.have.property('name', serverName); }); it('correct ttl', () => {