Remove *model.ChannelList from plugin API return parameter (#9844)

* Remove *model.ChannelList from plugin API return parametern

* Fix panic

* Add tests

* Changes as requested

* Fix panic in GetPublicChannelsForTeam()
Этот коммит содержится в:
Hanzei
2018-11-20 14:50:34 +01:00
коммит произвёл Joram Wilander
родитель 8cfca681b0
Коммит 0a73690537
5 изменённых файлов: 67 добавлений и 20 удалений

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

@@ -1778,11 +1778,11 @@ type Z_GetChannelsForTeamForUserArgs struct {
}
type Z_GetChannelsForTeamForUserReturns struct {
A *model.ChannelList
A []*model.Channel
B *model.AppError
}
func (g *apiRPCClient) GetChannelsForTeamForUser(teamId, userId string, includeDeleted bool) (*model.ChannelList, *model.AppError) {
func (g *apiRPCClient) GetChannelsForTeamForUser(teamId, userId string, includeDeleted bool) ([]*model.Channel, *model.AppError) {
_args := &Z_GetChannelsForTeamForUserArgs{teamId, userId, includeDeleted}
_returns := &Z_GetChannelsForTeamForUserReturns{}
if err := g.client.Call("Plugin.GetChannelsForTeamForUser", _args, _returns); err != nil {
@@ -1793,7 +1793,7 @@ func (g *apiRPCClient) GetChannelsForTeamForUser(teamId, userId string, includeD
func (s *apiRPCServer) GetChannelsForTeamForUser(args *Z_GetChannelsForTeamForUserArgs, returns *Z_GetChannelsForTeamForUserReturns) error {
if hook, ok := s.impl.(interface {
GetChannelsForTeamForUser(teamId, userId string, includeDeleted bool) (*model.ChannelList, *model.AppError)
GetChannelsForTeamForUser(teamId, userId string, includeDeleted bool) ([]*model.Channel, *model.AppError)
}); ok {
returns.A, returns.B = hook.GetChannelsForTeamForUser(args.A, args.B, args.C)
} else {
@@ -1925,11 +1925,11 @@ type Z_SearchChannelsArgs struct {
}
type Z_SearchChannelsReturns struct {
A *model.ChannelList
A []*model.Channel
B *model.AppError
}
func (g *apiRPCClient) SearchChannels(teamId string, term string) (*model.ChannelList, *model.AppError) {
func (g *apiRPCClient) SearchChannels(teamId string, term string) ([]*model.Channel, *model.AppError) {
_args := &Z_SearchChannelsArgs{teamId, term}
_returns := &Z_SearchChannelsReturns{}
if err := g.client.Call("Plugin.SearchChannels", _args, _returns); err != nil {
@@ -1940,7 +1940,7 @@ func (g *apiRPCClient) SearchChannels(teamId string, term string) (*model.Channe
func (s *apiRPCServer) SearchChannels(args *Z_SearchChannelsArgs, returns *Z_SearchChannelsReturns) error {
if hook, ok := s.impl.(interface {
SearchChannels(teamId string, term string) (*model.ChannelList, *model.AppError)
SearchChannels(teamId string, term string) ([]*model.Channel, *model.AppError)
}); ok {
returns.A, returns.B = hook.SearchChannels(args.A, args.B)
} else {