fix: update community invite push notification text (#2263)

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())
```
This commit is contained in:
Eric Mastro 2021-06-29 23:56:06 +10:00 committed by GitHub
parent 45a8de8e2b
commit 7c1765786a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 5 deletions

View File

@ -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()
@ -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 {
@ -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 {
@ -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
}
@ -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 {