-
Notifications
You must be signed in to change notification settings - Fork 244
/
adaptors.go
39 lines (33 loc) · 1.04 KB
/
adaptors.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package communities
import (
"github.com/status-im/status-go/protocol/protobuf"
)
func (o *Community) ToSyncInstallationCommunityProtobuf(clock uint64, communitySettings *CommunitySettings) (*protobuf.SyncInstallationCommunity, error) {
wrappedCommunity, err := o.ToProtocolMessageBytes()
if err != nil {
return nil, err
}
var rtjs []*protobuf.SyncCommunityRequestsToJoin
reqs := o.RequestsToJoin()
for _, req := range reqs {
rtjs = append(rtjs, req.ToSyncProtobuf())
}
settings := &protobuf.SyncCommunitySettings{
Clock: clock,
CommunityId: o.IDString(),
HistoryArchiveSupportEnabled: true,
}
if communitySettings != nil {
settings.HistoryArchiveSupportEnabled = communitySettings.HistoryArchiveSupportEnabled
}
return &protobuf.SyncInstallationCommunity{
Clock: clock,
Id: o.ID(),
Description: wrappedCommunity,
Joined: o.Joined(),
Verified: o.Verified(),
Muted: o.Muted(),
RequestsToJoin: rtjs,
Settings: settings,
}, nil
}