Refactor Get/Create Direct Channel into one function (#9867)

* refactor GetDirectChannel and CreateDirectChannel in one function

* remove CreateDirectChannel plugin api and update GetDirectChannel and GetGroupChannel plugin api

* update tests
Этот коммит содержится в:
Carlos Tadeu Panato Junior
2018-11-28 18:01:49 +01:00
коммит произвёл GitHub
родитель 09eae76c00
Коммит 1bcf08aa4b
18 изменённых файлов: 241 добавлений и 402 удалений

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

@@ -767,36 +767,6 @@ func (s *apiRPCServer) CreateUser(args *Z_CreateUserArgs, returns *Z_CreateUserR
return nil
}
type Z_CreateDirectChannelArgs struct {
A string
B string
}
type Z_CreateDirectChannelReturns struct {
A *model.Channel
B *model.AppError
}
func (g *apiRPCClient) CreateDirectChannel(userId1 string, userId2 string) (*model.Channel, *model.AppError) {
_args := &Z_CreateDirectChannelArgs{userId1, userId2}
_returns := &Z_CreateDirectChannelReturns{}
if err := g.client.Call("Plugin.CreateDirectChannel", _args, _returns); err != nil {
log.Printf("RPC call to CreateDirectChannel API failed: %s", err.Error())
}
return _returns.A, _returns.B
}
func (s *apiRPCServer) CreateDirectChannel(args *Z_CreateDirectChannelArgs, returns *Z_CreateDirectChannelReturns) error {
if hook, ok := s.impl.(interface {
CreateDirectChannel(userId1 string, userId2 string) (*model.Channel, *model.AppError)
}); ok {
returns.A, returns.B = hook.CreateDirectChannel(args.A, args.B)
} else {
return encodableError(fmt.Errorf("API CreateDirectChannel called but not implemented."))
}
return nil
}
type Z_DeleteUserArgs struct {
A string
}