Skip to content
Snippets Groups Projects
Commit 5f5172b8 authored by Jonah Husson's avatar Jonah Husson
Browse files

Add AreDMsEnabled to channels

parent 2fd6cdd4
No related branches found
No related tags found
2 merge requests!77Add AreDMsEnabled to channels,!67fix for latest client release
......@@ -10,7 +10,7 @@ require (
github.com/pkg/errors v0.9.1
github.com/spf13/cobra v1.5.0
github.com/spf13/jwalterweatherman v1.1.0
gitlab.com/elixxir/client/v4 v4.3.12-0.20230228194909-c9c2601830c2
gitlab.com/elixxir/client/v4 v4.3.12-0.20230228202420-22c4d11f2d7f
gitlab.com/elixxir/crypto v0.0.7-0.20230214180106-72841fd1e426
gitlab.com/elixxir/primitives v0.0.3-0.20230214180039-9a25e2d3969c
gitlab.com/xx_network/crypto v0.0.5-0.20230214003943-8a09396e95dd
......
......@@ -513,6 +513,8 @@ gitlab.com/elixxir/client/v4 v4.3.12-0.20230228180957-c62cc589d560 h1:wTIZoSxI/W
gitlab.com/elixxir/client/v4 v4.3.12-0.20230228180957-c62cc589d560/go.mod h1:Hjx99EdI86q67mHzZVR2Dw37fuTCzDaChM/NVX3CcPU=
gitlab.com/elixxir/client/v4 v4.3.12-0.20230228194909-c9c2601830c2 h1:cjObCobCH0IMSMEs57yAboAWPS1v8vpzO0ErHH5s4k8=
gitlab.com/elixxir/client/v4 v4.3.12-0.20230228194909-c9c2601830c2/go.mod h1:Hjx99EdI86q67mHzZVR2Dw37fuTCzDaChM/NVX3CcPU=
gitlab.com/elixxir/client/v4 v4.3.12-0.20230228202420-22c4d11f2d7f h1:raZyLq0MSjY33jXg5g2NgFl68LM1JJkAO3+0CHly15c=
gitlab.com/elixxir/client/v4 v4.3.12-0.20230228202420-22c4d11f2d7f/go.mod h1:Hjx99EdI86q67mHzZVR2Dw37fuTCzDaChM/NVX3CcPU=
gitlab.com/elixxir/comms v0.0.4-0.20230214180204-3aba2e6795af h1:Eye4+gZEUbOfz4j51WplYD9d7Gnr1s3wKYkEnCfhPaw=
gitlab.com/elixxir/comms v0.0.4-0.20230214180204-3aba2e6795af/go.mod h1:ud3s2aHx5zu7lJhBpUMUXxjLwl8PH8z8cl64Om9U7q8=
gitlab.com/elixxir/crypto v0.0.7-0.20230214180106-72841fd1e426 h1:O9Xz/ioc9NAj5k/QUsR0W4LCz2uVHawJF89yPTI7NXk=
......
......@@ -49,6 +49,7 @@ func newChannelsManagerJS(api *bindings.ChannelsManager) map[string]any {
"ReplayChannel": js.FuncOf(cm.ReplayChannel),
"EnableDirectMessages": js.FuncOf(cm.EnableDirectMessages),
"DisableDirectMessages": js.FuncOf(cm.DisableDirectMessages),
"AreDMsEnabled": js.FuncOf(cm.AreDMsEnabled),
// Share URL
"GetShareURL": js.FuncOf(cm.GetShareURL),
......@@ -873,6 +874,24 @@ func (cm *ChannelsManager) DisableDirectMessages(_ js.Value, args []js.Value) an
return nil
}
// AreDMsEnabled returns the status of direct messaging for a given channel.
//
// Parameters:
// - args[0] - Marshalled bytes of the channel [id.ID] (Uint8Array).
//
// Returns:
// - enabled (bool) - status of dms for passed in channel ID, true if enabled
// - Throws a TypeError if unmarshalling the channel ID
func (cm *ChannelsManager) AreDMsEnabled(_ js.Value, args []js.Value) any {
marshalledChanId := utils.CopyBytesToGo(args[0])
enabled, err := cm.api.AreDMsEnabled(marshalledChanId)
if err != nil {
utils.Throw(utils.TypeError, err)
return false
}
return enabled
}
////////////////////////////////////////////////////////////////////////////////
// Channel Share URL //
////////////////////////////////////////////////////////////////////////////////
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment