Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: missing display name when requesting to join a community #2725

Merged
merged 1 commit into from
Jun 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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