Skip to content

Commit

Permalink
Merge pull request #3834 from n0izn0iz/group-info-metadata
Browse files Browse the repository at this point in the history
fix(messenger): set group info on metadata log
  • Loading branch information
n0izn0iz committed Dec 30, 2021
2 parents 4d721d2 + 3af7b9e commit c1034dd
Show file tree
Hide file tree
Showing 12 changed files with 215 additions and 183 deletions.
1 change: 1 addition & 0 deletions api/messengertypes.proto
Original file line number Diff line number Diff line change
Expand Up @@ -708,6 +708,7 @@ message Interact {
string conversation_public_key = 3;
repeated string media_cids = 4;
string target_cid = 5 [(gogoproto.customname) = "TargetCID"];
bool metadata = 6;
}
message Reply {
string cid = 1 [(gogoproto.customname) = "CID"];
Expand Down
1 change: 1 addition & 0 deletions docs/apis/messengertypes.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions docs/apis/messengertypes.swagger.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/gen.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion go/gen.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 15 additions & 4 deletions go/pkg/bertymessenger/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -989,12 +989,23 @@ func (svc *service) Interact(ctx context.Context, req *messengertypes.Interact_R
}
}

reply, err := svc.protocolClient.AppMessageSend(ctx, &protocoltypes.AppMessageSend_Request{GroupPK: gpkb, Payload: fp, AttachmentCIDs: cids})
if err != nil {
return nil, errcode.ErrProtocolSend.Wrap(err)
var cidBytes []byte

if req.GetMetadata() {
reply, err := svc.protocolClient.AppMetadataSend(ctx, &protocoltypes.AppMetadataSend_Request{GroupPK: gpkb, Payload: fp, AttachmentCIDs: cids})
if err != nil {
return nil, errcode.ErrProtocolSend.Wrap(err)
}
cidBytes = reply.GetCID()
} else {
reply, err := svc.protocolClient.AppMessageSend(ctx, &protocoltypes.AppMessageSend_Request{GroupPK: gpkb, Payload: fp, AttachmentCIDs: cids})
if err != nil {
return nil, errcode.ErrProtocolSend.Wrap(err)
}
cidBytes = reply.GetCID()
}

cid, err := ipfscid.Cast(reply.GetCID())
cid, err := ipfscid.Cast(cidBytes)
if err != nil {
return nil, errcode.ErrDeserialization.Wrap(err)
}
Expand Down
360 changes: 184 additions & 176 deletions go/pkg/messengertypes/messengertypes.pb.go

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/gen.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions js/packages/api/root.pb.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions js/packages/api/root.pb.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions js/packages/components/chat/MultiMember.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ export const MultiMember: ScreenFC<'Chat.Group'> = ({ route: { params }, navigat
conversationPublicKey: conv?.publicKey,
type: beapi.messenger.AppMessage.Type.TypeSetGroupInfo,
payload: buf,
metadata: true,
})
setIsEdit(false)
}
Expand Down
1 change: 1 addition & 0 deletions js/packages/components/chat/MultiMemberSettings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ const GroupChatSettingsHeader: React.FC<{ publicKey: Maybe<string> }> = ({ publi
type: beapi.messenger.AppMessage.Type.TypeSetGroupInfo,
payload: buf,
mediaCids: [reply.cid],
metadata: true,
})
}
} catch (err) {
Expand Down

0 comments on commit c1034dd

Please sign in to comment.