diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/channel.go | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/app/channel.go b/app/channel.go index 347c106a8..db007dd3b 100644 --- a/app/channel.go +++ b/app/channel.go @@ -700,7 +700,7 @@ func LeaveChannel(channelId string, userId string) *model.AppError { return err } - if err := RemoveUserFromChannel(userId, userId, channel); err != nil { + if err := removeUserFromChannel(userId, userId, channel); err != nil { return err } @@ -765,7 +765,7 @@ func PostRemoveFromChannelMessage(removerUserId string, removedUser *model.User, return nil } -func RemoveUserFromChannel(userIdToRemove string, removerUserId string, channel *model.Channel) *model.AppError { +func removeUserFromChannel(userIdToRemove string, removerUserId string, channel *model.Channel) *model.AppError { if channel.DeleteAt > 0 { err := model.NewLocAppError("RemoveUserFromChannel", "api.channel.remove_user_from_channel.deleted.app_error", nil, "") err.StatusCode = http.StatusBadRequest @@ -797,6 +797,22 @@ func RemoveUserFromChannel(userIdToRemove string, removerUserId string, channel return nil } +func RemoveUserFromChannel(userIdToRemove string, removerUserId string, channel *model.Channel) *model.AppError { + var err *model.AppError + if err = removeUserFromChannel(userIdToRemove, removerUserId, channel); err != nil { + return err + } + + var user *model.User + if user, err = GetUser(userIdToRemove); err != nil { + return err + } + + go PostRemoveFromChannelMessage(removerUserId, user, channel) + + return nil +} + func GetNumberOfChannelsOnTeam(teamId string) (int, *model.AppError) { // Get total number of channels on current team if result := <-Srv.Store.Channel().GetTeamChannels(teamId); result.Err != nil { @@ -847,7 +863,7 @@ func SearchChannelsUserNotIn(teamId string, userId string, term string) (*model. } } -func ViewChannel(view *model.ChannelView, teamId string, userId string, clearPushNotifications bool) *model.AppError { +func ViewChannel(view *model.ChannelView, userId string, clearPushNotifications bool) *model.AppError { if err := SetActiveChannel(userId, view.ChannelId); err != nil { return err } |