[MM-23719] api4/channel: add move channel to a team endpoint (#14246)
* api4: add move channel method * api4: add tests for move channel, model: add move channel to client4.go * add api.channel.move_channel.type.invalid message * model/client4: remove a redundant line * api4/channel: add tests for gm and private channel types * app/channel: update move channel comment * app/channel: add extra check if a users joins to channel during movement * app/channel: log errors for post move channel * app/channel: remove deactivated members by default while moving a ch. * model/client: update move channel command * fix vet errors * app/channel: add missing webhook updates Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
0e714f350a
Коммит
124014ad9c
@@ -2456,6 +2456,19 @@ func (c *Client4) DeleteChannel(channelId string) (bool, *Response) {
|
||||
return CheckStatusOK(r), BuildResponse(r)
|
||||
}
|
||||
|
||||
// MoveChannel moves the channel to the destination team.
|
||||
func (c *Client4) MoveChannel(channelId, teamId string) (*Channel, *Response) {
|
||||
requestBody := map[string]string{
|
||||
"team_id": teamId,
|
||||
}
|
||||
r, err := c.DoApiPost(c.GetChannelRoute(channelId)+"/move", MapToJson(requestBody))
|
||||
if err != nil {
|
||||
return nil, BuildErrorResponse(r, err)
|
||||
}
|
||||
defer closeBody(r)
|
||||
return ChannelFromJson(r.Body), BuildResponse(r)
|
||||
}
|
||||
|
||||
// GetChannelByName returns a channel based on the provided channel name and team id strings.
|
||||
func (c *Client4) GetChannelByName(channelName, teamId string, etag string) (*Channel, *Response) {
|
||||
r, err := c.DoApiGet(c.GetChannelByNameRoute(channelName, teamId), etag)
|
||||
|
||||
Ссылка в новой задаче
Block a user