summaryrefslogtreecommitdiffstats
path: root/plugin/plugintest
diff options
context:
space:
mode:
authorJesse Hallam <jesse.hallam@gmail.com>2018-04-06 17:08:57 -0400
committerJoram Wilander <jwawilander@gmail.com>2018-04-06 17:08:57 -0400
commit116849842be59bc6960df415f23155ec8e767f06 (patch)
tree582794ce6efc92f4564118cbb0a1841699f16a19 /plugin/plugintest
parentff077c6761bd4b6d170831f7f2ba474c2a9bd5e0 (diff)
downloadchat-116849842be59bc6960df415f23155ec8e767f06.tar.gz
chat-116849842be59bc6960df415f23155ec8e767f06.tar.bz2
chat-116849842be59bc6960df415f23155ec8e767f06.zip
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
Diffstat (limited to 'plugin/plugintest')
-rw-r--r--plugin/plugintest/api.go39
1 files changed, 39 insertions, 0 deletions
diff --git a/plugin/plugintest/api.go b/plugin/plugintest/api.go
index 75174a9a6..8f9f4a604 100644
--- a/plugin/plugintest/api.go
+++ b/plugin/plugintest/api.go
@@ -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 {