forked from cwtch.im/cwtch
Merge pull request 'Gate the Import Bundle method for Managed Groups' (#564) from managed-groups into master
Reviewed-on: cwtch.im/cwtch#564 Reviewed-by: Dan Ballard <dan@openprivacy.ca>
This commit is contained in:
commit
9b235ba732
|
@ -1,9 +1,11 @@
|
|||
package inter
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"strings"
|
||||
|
||||
"cwtch.im/cwtch/functionality/hybrid"
|
||||
"cwtch.im/cwtch/model/constants"
|
||||
"cwtch.im/cwtch/peer"
|
||||
)
|
||||
|
||||
|
@ -23,8 +25,12 @@ func (i InterfaceFunctionality) ImportBundle(profile peer.CwtchPeer, uri string)
|
|||
// check if this is a managed group. Note: managed groups do not comply with the server bundle format.
|
||||
if strings.HasPrefix(uri, "managed:") {
|
||||
uri = uri[len("managed:"):]
|
||||
mgf := hybrid.ManagedGroupFunctionality{}
|
||||
return mgf.NewManagedGroup(profile, uri)
|
||||
if profile.IsFeatureEnabled(constants.GroupsExperiment) {
|
||||
mgf := hybrid.ManagedGroupFunctionality{}
|
||||
return mgf.NewManagedGroup(profile, uri)
|
||||
} else {
|
||||
return errors.New("managed groups require the group experiment to be enabled")
|
||||
}
|
||||
}
|
||||
// DEV NOTE: we may want to eventually move Server Import code to ServerFunctionality and add a hook here...
|
||||
// DEV NOTE: consider making ImportBundle a high-level functionality interface? to support different kinds of contacts?
|
||||
|
|
Loading…
Reference in New Issue