[MM-16934] Add API endpoint to update channel privacy (#11993)
* Add API endpoint to update channel privacy setting * Fix language files * Improve tests by making sure channel has been updated correctly * Improve tests
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
6a2f09ae78
Коммит
ad9784d7e3
@@ -2100,6 +2100,17 @@ func (c *Client4) ConvertChannelToPrivate(channelId string) (*Channel, *Response
|
||||
return ChannelFromJson(r.Body), BuildResponse(r)
|
||||
}
|
||||
|
||||
// UpdateChannelPrivacy updates channel privacy
|
||||
func (c *Client4) UpdateChannelPrivacy(channelId string, privacy string) (*Channel, *Response) {
|
||||
requestBody := map[string]string{"privacy": privacy}
|
||||
r, err := c.DoApiPut(c.GetChannelRoute(channelId)+"/privacy", MapToJson(requestBody))
|
||||
if err != nil {
|
||||
return nil, BuildErrorResponse(r, err)
|
||||
}
|
||||
defer closeBody(r)
|
||||
return ChannelFromJson(r.Body), BuildResponse(r)
|
||||
}
|
||||
|
||||
// RestoreChannel restores a previously deleted channel. Any missing fields are not updated.
|
||||
func (c *Client4) RestoreChannel(channelId string) (*Channel, *Response) {
|
||||
r, err := c.DoApiPost(c.GetChannelRoute(channelId)+"/restore", "")
|
||||
|
||||
Ссылка в новой задаче
Block a user