[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
@@ -8762,6 +8762,26 @@ func (s *RetryLayerTeamStore) GetChannelUnreadsForTeam(teamID string, userID str
|
||||
|
||||
}
|
||||
|
||||
func (s *RetryLayerTeamStore) GetCommonTeamIDsForTwoUsers(userID string, otherUserID string) ([]string, error) {
|
||||
|
||||
tries := 0
|
||||
for {
|
||||
result, err := s.TeamStore.GetCommonTeamIDsForTwoUsers(userID, otherUserID)
|
||||
if err == nil {
|
||||
return result, nil
|
||||
}
|
||||
if !isRepeatableError(err) {
|
||||
return result, err
|
||||
}
|
||||
tries++
|
||||
if tries >= 3 {
|
||||
err = errors.Wrap(err, "giving up after 3 consecutive repeatable transaction failures")
|
||||
return result, err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func (s *RetryLayerTeamStore) GetMember(ctx context.Context, teamID string, userID string) (*model.TeamMember, error) {
|
||||
|
||||
tries := 0
|
||||
|
||||
Ссылка в новой задаче
Block a user