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()
Этот коммит содержится в:
коммит произвёл
Joram Wilander
родитель
8cfca681b0
Коммит
0a73690537
@@ -178,7 +178,7 @@ type API interface {
|
||||
// GetChannelsForTeamForUser gets a list of channels for given user ID in given team ID.
|
||||
//
|
||||
// Minimum server version: 5.6
|
||||
GetChannelsForTeamForUser(teamId, userId string, includeDeleted bool) (*model.ChannelList, *model.AppError)
|
||||
GetChannelsForTeamForUser(teamId, userId string, includeDeleted bool) ([]*model.Channel, *model.AppError)
|
||||
|
||||
// GetChannelStats gets statistics for a channel.
|
||||
//
|
||||
@@ -197,7 +197,7 @@ type API interface {
|
||||
// SearchChannels returns the channels on a team matching the provided search term.
|
||||
//
|
||||
// Minimum server version: 5.6
|
||||
SearchChannels(teamId string, term string) (*model.ChannelList, *model.AppError)
|
||||
SearchChannels(teamId string, term string) ([]*model.Channel, *model.AppError)
|
||||
|
||||
// AddChannelMember creates a channel membership for a user.
|
||||
AddChannelMember(channelId, userId string) (*model.ChannelMember, *model.AppError)
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -541,15 +541,15 @@ func (_m *API) GetChannelStats(channelId string) (*model.ChannelStats, *model.Ap
|
||||
}
|
||||
|
||||
// GetChannelsForTeamForUser provides a mock function with given fields: teamId, userId, includeDeleted
|
||||
func (_m *API) GetChannelsForTeamForUser(teamId string, userId string, includeDeleted bool) (*model.ChannelList, *model.AppError) {
|
||||
func (_m *API) GetChannelsForTeamForUser(teamId string, userId string, includeDeleted bool) ([]*model.Channel, *model.AppError) {
|
||||
ret := _m.Called(teamId, userId, includeDeleted)
|
||||
|
||||
var r0 *model.ChannelList
|
||||
if rf, ok := ret.Get(0).(func(string, string, bool) *model.ChannelList); ok {
|
||||
var r0 []*model.Channel
|
||||
if rf, ok := ret.Get(0).(func(string, string, bool) []*model.Channel); ok {
|
||||
r0 = rf(teamId, userId, includeDeleted)
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).(*model.ChannelList)
|
||||
r0 = ret.Get(0).([]*model.Channel)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1866,15 +1866,15 @@ func (_m *API) SavePluginConfig(pluginConfig map[string]interface{}) *model.AppE
|
||||
}
|
||||
|
||||
// SearchChannels provides a mock function with given fields: teamId, term
|
||||
func (_m *API) SearchChannels(teamId string, term string) (*model.ChannelList, *model.AppError) {
|
||||
func (_m *API) SearchChannels(teamId string, term string) ([]*model.Channel, *model.AppError) {
|
||||
ret := _m.Called(teamId, term)
|
||||
|
||||
var r0 *model.ChannelList
|
||||
if rf, ok := ret.Get(0).(func(string, string) *model.ChannelList); ok {
|
||||
var r0 []*model.Channel
|
||||
if rf, ok := ret.Get(0).(func(string, string) []*model.Channel); ok {
|
||||
r0 = rf(teamId, term)
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).(*model.ChannelList)
|
||||
r0 = ret.Get(0).([]*model.Channel)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Ссылка в новой задаче
Block a user