MM-34002: Improve AddUserToChannel (#17174)
* MM-34002: Improve AddUserToChannel When we would add a user to a channel, we would check whether the user is removed from that team or not. During LDAP sync, this check is not required because the team member would have just been created. Hence, we pass a boolean flag to bypass the check. And with that done, we can freely query the replica. https://mattermost.atlassian.net/browse/MM-34002 ```release-note NONE ``` * Refactor code * Rename a struct field * fix double negative
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
4f0cfbe329
Коммит
db01f2a91b
@@ -478,27 +478,27 @@ func (api *PluginAPI) SearchPostsInTeamForUser(teamID string, userID string, sea
|
||||
}
|
||||
|
||||
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)
|
||||
return api.app.AddChannelMember(userID, channel, ChannelMemberOpts{
|
||||
// For now, don't allow overriding these via the plugin API.
|
||||
UserRequestorID: "",
|
||||
PostRootID: "",
|
||||
})
|
||||
}
|
||||
|
||||
func (api *PluginAPI) AddUserToChannel(channelID, userID, asUserId string) (*model.ChannelMember, *model.AppError) {
|
||||
postRootId := ""
|
||||
|
||||
func (api *PluginAPI) AddUserToChannel(channelID, userID, asUserID string) (*model.ChannelMember, *model.AppError) {
|
||||
channel, err := api.GetChannel(channelID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return api.app.AddChannelMember(userID, channel, asUserId, postRootId)
|
||||
return api.app.AddChannelMember(userID, channel, ChannelMemberOpts{
|
||||
UserRequestorID: asUserID,
|
||||
})
|
||||
}
|
||||
|
||||
func (api *PluginAPI) GetChannelMember(channelID, userID string) (*model.ChannelMember, *model.AppError) {
|
||||
|
||||
Ссылка в новой задаче
Block a user