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
@@ -124,10 +124,35 @@ func (api *PluginAPI) UpdateChannel(channel *model.Channel) (*model.Channel, *mo
|
||||
return api.app.UpdateChannel(channel)
|
||||
}
|
||||
|
||||
func (api *PluginAPI) AddChannelMember(channelId, userId string) (*model.ChannelMember, *model.AppError) {
|
||||
// For now, don't allow overriding these via the plugin API.
|
||||
userRequestorId := ""
|
||||
postRootId := ""
|
||||
|
||||
channel, err := api.GetChannel(channelId)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return api.app.AddChannelMember(userId, channel, userRequestorId, postRootId)
|
||||
}
|
||||
|
||||
func (api *PluginAPI) GetChannelMember(channelId, userId string) (*model.ChannelMember, *model.AppError) {
|
||||
return api.app.GetChannelMember(channelId, userId)
|
||||
}
|
||||
|
||||
func (api *PluginAPI) UpdateChannelMemberRoles(channelId, userId, newRoles string) (*model.ChannelMember, *model.AppError) {
|
||||
return api.app.UpdateChannelMemberRoles(channelId, userId, newRoles)
|
||||
}
|
||||
|
||||
func (api *PluginAPI) UpdateChannelMemberNotifications(channelId, userId string, notifications map[string]string) (*model.ChannelMember, *model.AppError) {
|
||||
return api.app.UpdateChannelMemberNotifyProps(notifications, channelId, userId)
|
||||
}
|
||||
|
||||
func (api *PluginAPI) DeleteChannelMember(channelId, userId string) *model.AppError {
|
||||
return api.app.LeaveChannel(channelId, userId)
|
||||
}
|
||||
|
||||
func (api *PluginAPI) CreatePost(post *model.Post) (*model.Post, *model.AppError) {
|
||||
return api.app.CreatePostMissingChannel(post, true)
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user