Skip to content

Commit

Permalink
fix: missing display name when requesting to join a community (#2725)
Browse files Browse the repository at this point in the history
  • Loading branch information
richard-ramos authored Jun 22, 2022
1 parent dca550e commit 31feea9
Show file tree
Hide file tree
Showing 4 changed files with 102 additions and 79 deletions.
6 changes: 6 additions & 0 deletions protocol/messenger_communities.go
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,11 @@ func (m *Messenger) RequestToJoinCommunity(request *requests.RequestToJoinCommun
return nil, err
}

displayName, err := m.settings.DisplayName()
if err != nil {
return nil, err
}

community, requestToJoin, err := m.communitiesManager.RequestToJoin(&m.identity.PublicKey, request)
if err != nil {
return nil, err
Expand All @@ -366,6 +371,7 @@ func (m *Messenger) RequestToJoinCommunity(request *requests.RequestToJoinCommun
requestToJoinProto := &protobuf.CommunityRequestToJoin{
Clock: requestToJoin.Clock,
EnsName: requestToJoin.ENSName,
DisplayName: displayName,
CommunityId: community.ID(),
}

Expand Down
7 changes: 7 additions & 0 deletions protocol/messenger_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -961,6 +961,13 @@ func (m *Messenger) HandleCommunityRequestToJoin(state *ReceivedMessageState, si

contact, _ := state.AllContacts.Load(contactID)

if len(requestToJoinProto.DisplayName) != 0 {
contact.DisplayName = requestToJoinProto.DisplayName
state.ModifiedContacts.Store(contact.ID, true)
state.AllContacts.Store(contact.ID, contact)
state.ModifiedContacts.Store(contact.ID, true)
}

state.Response.AddNotification(NewCommunityRequestToJoinNotification(requestToJoin.ID.String(), community, contact))

return nil
Expand Down
167 changes: 88 additions & 79 deletions protocol/protobuf/communities.pb.go

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

1 change: 1 addition & 0 deletions protocol/protobuf/communities.proto
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ message CommunityRequestToJoin {
string ens_name = 2;
string chat_id = 3;
bytes community_id = 4;
string display_name = 5;
}

message CommunityRequestToJoinResponse {
Expand Down

0 comments on commit 31feea9

Please sign in to comment.