satellite/console: Update project members endpoint
We don't need to send all the information that the endpoint currently provides - name and email is sufficient. Change-Id: I088d61edfc022a4a40c96e1faebd48808af5b00f
This commit is contained in:
parent
f749b8ff51
commit
dcc3245954
@ -389,14 +389,24 @@ func (p *Projects) GetMembersAndInvitations(w http.ResponseWriter, r *http.Reque
|
||||
memberPage.Members = []Member{}
|
||||
memberPage.Invitations = []Invitation{}
|
||||
|
||||
// getMemberInfo returns only member information that is necessary in the UI
|
||||
getMemberInfo := func(u *console.User) *console.User {
|
||||
return &console.User{
|
||||
ID: u.ID,
|
||||
FullName: u.FullName,
|
||||
ShortName: u.ShortName,
|
||||
Email: u.Email,
|
||||
}
|
||||
}
|
||||
for _, m := range membersAndInvitations.ProjectMembers {
|
||||
user, err := p.service.GetUser(ctx, m.MemberID)
|
||||
if err != nil {
|
||||
p.serveJSONError(ctx, w, http.StatusInternalServerError, err)
|
||||
return
|
||||
}
|
||||
u := getMemberInfo(user)
|
||||
member := Member{
|
||||
User: user,
|
||||
User: u,
|
||||
JoinedAt: m.CreatedAt,
|
||||
}
|
||||
memberPage.Members = append(memberPage.Members, member)
|
||||
|
Loading…
Reference in New Issue
Block a user