[MM-25659] ability to permanent delete channel through client (#15202)

Summary

    Ability to permanent delete channel through client

Ticket Link

    https://mattermost.atlassian.net/browse/MM-25659
This commit is contained in:
Ashish Bhate
2020-08-14 08:42:39 +00:00
committed by GitHub
parent 11513a8d0d
commit d76039db23
7 changed files with 113 additions and 2 deletions

View File

@@ -2562,6 +2562,16 @@ func (c *Client4) DeleteChannel(channelId string) (bool, *Response) {
return CheckStatusOK(r), BuildResponse(r)
}
// PermanentDeleteChannel deletes a channel based on the provided channel id string.
func (c *Client4) PermanentDeleteChannel(channelId string) (bool, *Response) {
r, err := c.DoApiDelete(c.GetChannelRoute(channelId) + "?permanent=" + c.boolString(true))
if err != nil {
return false, BuildErrorResponse(r, err)
}
defer closeBody(r)
return CheckStatusOK(r), BuildResponse(r)
}
// MoveChannel moves the channel to the destination team.
func (c *Client4) MoveChannel(channelId, teamId string, force bool) (*Channel, *Response) {
requestBody := map[string]interface{}{

View File

@@ -329,6 +329,7 @@ type ServiceSettings struct {
DEPRECATED_DO_NOT_USE_ImageProxyOptions *string `json:"ImageProxyOptions" mapstructure:"ImageProxyOptions"` // This field is deprecated and must not be used.
EnableAPITeamDeletion *bool
EnableAPIUserDeletion *bool
EnableAPIChannelDeletion *bool
ExperimentalEnableHardenedMode *bool
DisableLegacyMFA *bool `restricted:"true"`
ExperimentalStrictCSRFEnforcement *bool `restricted:"true"`
@@ -705,6 +706,10 @@ func (s *ServiceSettings) SetDefaults(isUpdate bool) {
s.EnableAPIUserDeletion = NewBool(false)
}
if s.EnableAPIChannelDeletion == nil {
s.EnableAPIChannelDeletion = NewBool(false)
}
if s.ExperimentalEnableHardenedMode == nil {
s.ExperimentalEnableHardenedMode = NewBool(false)
}