github.com/status-im/status-go@v1.1.0/protocol/communities/adaptors.go (about) 1 package communities 2 3 import ( 4 "github.com/status-im/status-go/protocol/protobuf" 5 ) 6 7 func (o *Community) ToSyncInstallationCommunityProtobuf(clock uint64, communitySettings *CommunitySettings, syncControlNode *protobuf.SyncCommunityControlNode) (*protobuf.SyncInstallationCommunity, error) { 8 wrappedCommunity, err := o.ToProtocolMessageBytes() 9 if err != nil { 10 return nil, err 11 } 12 13 var rtjs []*protobuf.SyncCommunityRequestsToJoin 14 reqs := o.RequestsToJoin() 15 for _, req := range reqs { 16 rtjs = append(rtjs, req.ToSyncProtobuf()) 17 } 18 19 settings := &protobuf.SyncCommunitySettings{ 20 Clock: clock, 21 CommunityId: o.IDString(), 22 HistoryArchiveSupportEnabled: true, 23 } 24 25 if communitySettings != nil { 26 settings.HistoryArchiveSupportEnabled = communitySettings.HistoryArchiveSupportEnabled 27 } 28 29 return &protobuf.SyncInstallationCommunity{ 30 Clock: clock, 31 Id: o.ID(), 32 Description: wrappedCommunity, 33 Joined: o.Joined(), 34 JoinedAt: o.JoinedAt(), 35 Spectated: o.Spectated(), 36 Verified: o.Verified(), 37 Muted: o.Muted(), 38 RequestsToJoin: rtjs, 39 Settings: settings, 40 ControlNode: syncControlNode, 41 LastOpenedAt: o.LastOpenedAt(), 42 }, nil 43 }