Skip to content

Commit

Permalink
fix: update community invite push notification text (#2263)
Browse files Browse the repository at this point in the history
Changes the community invitation text notifications from

“Upgrade to see a community invitation”

to

**InviteUsersToCommunity**
```golang
fmt.Sprintf("You have been invited to the community %s", community.Name())
```

**ShareCommunity**
```golang
fmt.Sprintf("Community %s has been shared with you", community.Name())
```
  • Loading branch information
emizzle committed Jun 29, 2021
1 parent 45a8de8 commit 7c17657
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions protocol/messenger_communities.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ import (
"github.com/status-im/status-go/protocol/transport"
)

const communityInvitationText = "Upgrade to see a community invitation"

func (m *Messenger) publishOrg(org *communities.Community) error {
m.logger.Debug("publishing org", zap.String("org-id", org.IDString()), zap.Any("org", org))
payload, err := org.MarshaledDescription()
Expand Down Expand Up @@ -519,6 +517,10 @@ func (m *Messenger) InviteUsersToCommunity(request *requests.InviteUsersToCommun
var messages []*common.Message

var publicKeys []*ecdsa.PublicKey
community, err := m.communitiesManager.GetByID(request.CommunityID)
if err != nil {
return nil, err
}
for _, pkBytes := range request.Users {
publicKey, err := common.HexToPubkey(pkBytes.String())
if err != nil {
Expand All @@ -529,7 +531,7 @@ func (m *Messenger) InviteUsersToCommunity(request *requests.InviteUsersToCommun
message := &common.Message{}
message.ChatId = pkBytes.String()
message.CommunityID = request.CommunityID.String()
message.Text = communityInvitationText
message.Text = fmt.Sprintf("You have been invited to community %s", community.Name())
messages = append(messages, message)
r, err := m.CreateOneToOneChat(&requests.CreateOneToOneChat{ID: pkBytes})
if err != nil {
Expand All @@ -541,7 +543,7 @@ func (m *Messenger) InviteUsersToCommunity(request *requests.InviteUsersToCommun
}
}

community, err := m.communitiesManager.InviteUsersToCommunity(request.CommunityID, publicKeys)
community, err = m.communitiesManager.InviteUsersToCommunity(request.CommunityID, publicKeys)
if err != nil {
return nil, err
}
Expand All @@ -564,12 +566,17 @@ func (m *Messenger) ShareCommunity(request *requests.ShareCommunity) (*Messenger
}
response := &MessengerResponse{}

community, err := m.communitiesManager.GetByID(request.CommunityID)
if err != nil {
return nil, err
}

var messages []*common.Message
for _, pk := range request.Users {
message := &common.Message{}
message.ChatId = pk.String()
message.CommunityID = request.CommunityID.String()
message.Text = communityInvitationText
message.Text = fmt.Sprintf("Community %s has been shared with you", community.Name())
messages = append(messages, message)
r, err := m.CreateOneToOneChat(&requests.CreateOneToOneChat{ID: pk})
if err != nil {
Expand Down

0 comments on commit 7c17657

Please sign in to comment.