MM-8678: add CUD support for channel members via plugins (#8565)
* add CUD support for channel members via plugins This effectively exposes AddChannelMember, UpdateChannelMemberRoles, UpdateChannelMemberNotifyProps and LeaveChannel via the plugin API. It also modifies the semantics of AddChannelMember to explicitly allow for an empty user requestor, left as such for now via the plugin API. * change the signature of AddChannelMember to accept a channel id instead of a channel
Этот коммит содержится в:
коммит произвёл
Joram Wilander
родитель
ff077c6761
Коммит
116849842b
@@ -223,6 +223,16 @@ func (m *API) UpdateChannel(channel *model.Channel) (*model.Channel, *model.AppE
|
||||
return channelOut, err
|
||||
}
|
||||
|
||||
func (m *API) AddChannelMember(channelId, userId string) (*model.ChannelMember, *model.AppError) {
|
||||
ret := m.Called(channelId, userId)
|
||||
if f, ok := ret.Get(0).(func(_, _ string) (*model.ChannelMember, *model.AppError)); ok {
|
||||
return f(channelId, userId)
|
||||
}
|
||||
member, _ := ret.Get(0).(*model.ChannelMember)
|
||||
err, _ := ret.Get(1).(*model.AppError)
|
||||
return member, err
|
||||
}
|
||||
|
||||
func (m *API) GetChannelMember(channelId, userId string) (*model.ChannelMember, *model.AppError) {
|
||||
ret := m.Called(channelId, userId)
|
||||
if f, ok := ret.Get(0).(func(_, _ string) (*model.ChannelMember, *model.AppError)); ok {
|
||||
@@ -233,6 +243,35 @@ func (m *API) GetChannelMember(channelId, userId string) (*model.ChannelMember,
|
||||
return member, err
|
||||
}
|
||||
|
||||
func (m *API) UpdateChannelMemberRoles(channelId, userId, newRoles string) (*model.ChannelMember, *model.AppError) {
|
||||
ret := m.Called(channelId, userId, newRoles)
|
||||
if f, ok := ret.Get(0).(func(_, _, _ string) (*model.ChannelMember, *model.AppError)); ok {
|
||||
return f(channelId, userId, newRoles)
|
||||
}
|
||||
member, _ := ret.Get(0).(*model.ChannelMember)
|
||||
err, _ := ret.Get(1).(*model.AppError)
|
||||
return member, err
|
||||
}
|
||||
|
||||
func (m *API) UpdateChannelMemberNotifications(channelId, userId string, notifications map[string]string) (*model.ChannelMember, *model.AppError) {
|
||||
ret := m.Called(channelId, userId, notifications)
|
||||
if f, ok := ret.Get(0).(func(_, _ string, _ map[string]string) (*model.ChannelMember, *model.AppError)); ok {
|
||||
return f(channelId, userId, notifications)
|
||||
}
|
||||
member, _ := ret.Get(0).(*model.ChannelMember)
|
||||
err, _ := ret.Get(1).(*model.AppError)
|
||||
return member, err
|
||||
}
|
||||
|
||||
func (m *API) DeleteChannelMember(channelId, userId string) *model.AppError {
|
||||
ret := m.Called(channelId, userId)
|
||||
if f, ok := ret.Get(0).(func(_, _ string) *model.AppError); ok {
|
||||
return f(channelId, userId)
|
||||
}
|
||||
err, _ := ret.Get(0).(*model.AppError)
|
||||
return err
|
||||
}
|
||||
|
||||
func (m *API) CreatePost(post *model.Post) (*model.Post, *model.AppError) {
|
||||
ret := m.Called(post)
|
||||
if f, ok := ret.Get(0).(func(*model.Post) (*model.Post, *model.AppError)); ok {
|
||||
|
||||
Ссылка в новой задаче
Block a user