[MM-32622] Remove app.WaitForChannelMembership() (#17048)

* Remove app.WaitForChannelMembership

* Fix tests

* Fix test

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
Claudio Costa
2021-03-31 09:40:35 +02:00
коммит произвёл GitHub
родитель 4ba0c09fc7
Коммит ee3f986da0
32 изменённых файлов: 211 добавлений и 227 удалений

Просмотреть файл

@@ -4,6 +4,7 @@
package slashcommands
import (
"context"
"strings"
"github.com/mattermost/mattermost-server/v5/app"
@@ -103,7 +104,7 @@ func (*InviteProvider) DoCommand(a *app.App, args *model.CommandArgs, message st
}
case model.CHANNEL_PRIVATE:
if !a.HasPermissionToChannel(args.UserId, channelToJoin.Id, model.PERMISSION_MANAGE_PRIVATE_CHANNEL_MEMBERS) {
if _, err = a.GetChannelMember(channelToJoin.Id, args.UserId); err == nil {
if _, err = a.GetChannelMember(context.Background(), channelToJoin.Id, args.UserId); err == nil {
// User doing the inviting is a member of the channel.
return &model.CommandResponse{
Text: args.T("api.command_invite.permission.app_error", map[string]interface{}{
@@ -129,7 +130,7 @@ func (*InviteProvider) DoCommand(a *app.App, args *model.CommandArgs, message st
}
// Check if user is already in the channel
_, err = a.GetChannelMember(channelToJoin.Id, userProfile.Id)
_, err = a.GetChannelMember(context.Background(), channelToJoin.Id, userProfile.Id)
if err == nil {
return &model.CommandResponse{
Text: args.T("api.command_invite.user_already_in_channel.app_error", map[string]interface{}{