mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
[MM-21517] Team Member Manage User Modal not display correct roles (#14043)
* join on the users table and order by username * don't inclue users who have been deleted * Address PR comments * update tests * fix linting * fix linting * include ExcludeDeletedUsers flag * fix gofmt * fix nil teamMembersGetOptions * fix gofmt error * Add Unit Tests * fix gofmt bugs * partially address comments * fix incorrect import * Address Comments and fix golint errors * store mocks * address PR comments about tests and styling * Update model/team_member.go Co-Authored-By: Jesse Hallam <jesse.hallam@gmail.com> * Address PR comments * update client function name Co-authored-by: mattermod <mattermod@users.noreply.github.com> Co-authored-by: Jesse Hallam <jesse.hallam@gmail.com>
This commit is contained in:
committed by
GitHub
parent
7ce68e89d7
commit
bd2c1f4522
@@ -1805,6 +1805,18 @@ func (c *Client4) GetTeamMembers(teamId string, page int, perPage int, etag stri
|
||||
return TeamMembersFromJson(r.Body), BuildResponse(r)
|
||||
}
|
||||
|
||||
// GetTeamMembersWithoutDeletedUsers returns team members based on the provided team id string. Additional parameters of sort and exclude_deleted_users accepted as well
|
||||
// Could not add it to above function due to it be a breaking change.
|
||||
func (c *Client4) GetTeamMembersSortAndWithoutDeletedUsers(teamId string, page int, perPage int, sort string, exclude_deleted_users bool, etag string) ([]*TeamMember, *Response) {
|
||||
query := fmt.Sprintf("?page=%v&per_page=%v&sort=%v&exclude_deleted_users=%v", page, perPage, sort, exclude_deleted_users)
|
||||
r, err := c.DoApiGet(c.GetTeamMembersRoute(teamId)+query, etag)
|
||||
if err != nil {
|
||||
return nil, BuildErrorResponse(r, err)
|
||||
}
|
||||
defer closeBody(r)
|
||||
return TeamMembersFromJson(r.Body), BuildResponse(r)
|
||||
}
|
||||
|
||||
// GetTeamMembersForUser returns the team members for a user.
|
||||
func (c *Client4) GetTeamMembersForUser(userId string, etag string) ([]*TeamMember, *Response) {
|
||||
r, err := c.DoApiGet(c.GetUserRoute(userId)+"/teams/members", etag)
|
||||
|
||||
@@ -11,6 +11,10 @@ import (
|
||||
"strings"
|
||||
)
|
||||
|
||||
const (
|
||||
USERNAME = "Username"
|
||||
)
|
||||
|
||||
type TeamMember struct {
|
||||
TeamId string `json:"team_id"`
|
||||
UserId string `json:"user_id"`
|
||||
@@ -44,6 +48,17 @@ type EmailInviteWithError struct {
|
||||
Error *AppError `json:"error"`
|
||||
}
|
||||
|
||||
type TeamMembersGetOptions struct {
|
||||
// Sort the team members. Accepts "Username", but defaults to "Id".
|
||||
Sort string
|
||||
|
||||
// If true, exclude team members whose corresponding user is deleted.
|
||||
ExcludeDeletedUsers bool
|
||||
|
||||
// Restrict to search in a list of teams and channels
|
||||
ViewRestrictions *ViewUsersRestrictions
|
||||
}
|
||||
|
||||
func (o *TeamMember) ToJson() string {
|
||||
b, _ := json.Marshal(o)
|
||||
return string(b)
|
||||
|
||||
Reference in New Issue
Block a user