[MM-7968] restrict creation of direct channels to team members (#17222)
* restrict creation of direct channels to team members * run make i18n-extract * add suggestions from hahmadia * place common-team-check logic in app layer * use flat SQL query * show more specific error message to user * MM-7968: Fmt file. * MM-7968: Fix for moved session field. Co-authored-by: Max Erenberg <max.erenberg@mattermost.com> Co-authored-by: Mattermod <mattermod@users.noreply.github.com> Co-authored-by: Martin Kraft <martinkraft@gmail.com> Co-authored-by: Martin Kraft <martin@upspin.org>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
3681cd3688
Коммит
9ef41a55e2
@@ -1016,6 +1016,14 @@ func (a *App) GetTeamMembersByIds(teamID string, userIDs []string, restrictions
|
||||
return teamMembers, nil
|
||||
}
|
||||
|
||||
func (a *App) GetCommonTeamIDsForTwoUsers(userID, otherUserID string) ([]string, *model.AppError) {
|
||||
teamIDs, err := a.Srv().Store.Team().GetCommonTeamIDsForTwoUsers(userID, otherUserID)
|
||||
if err != nil {
|
||||
return nil, model.NewAppError("GetCommonTeamIDsForUsers", "app.team.get_common_team_ids_for_users.app_error", nil, err.Error(), http.StatusInternalServerError)
|
||||
}
|
||||
return teamIDs, nil
|
||||
}
|
||||
|
||||
func (a *App) AddTeamMember(c *request.Context, teamID, userID string) (*model.TeamMember, *model.AppError) {
|
||||
_, teamMember, err := a.AddUserToTeam(c, teamID, userID, "")
|
||||
if err != nil {
|
||||
|
||||
Ссылка в новой задаче
Block a user