SignupInvitedPage: Show orgName (#94940)
* no orgname * format code * update unit test * delete contextSrv * fix unit test * run prettier --------- Co-authored-by: Laura Benz <laura.benz@grafana.com>
This commit is contained in:
@@ -17,6 +17,7 @@ type InviteInfo struct {
|
||||
Name string `json:"name"`
|
||||
Username string `json:"username"`
|
||||
InvitedBy string `json:"invitedBy"`
|
||||
OrgName string `json:"orgName"`
|
||||
}
|
||||
|
||||
type CompleteInviteForm struct {
|
||||
|
||||
@@ -220,11 +220,22 @@ func (hs *HTTPServer) GetInviteInfoByCode(c *contextmodel.ReqContext) response.R
|
||||
return response.Error(http.StatusNotFound, "Invite not found", nil)
|
||||
}
|
||||
|
||||
orgResult, err := hs.orgService.GetByID(c.Req.Context(), &org.GetOrgByIDQuery{
|
||||
ID: invite.OrgID,
|
||||
})
|
||||
if err != nil {
|
||||
if errors.Is(err, org.ErrOrgNotFound) {
|
||||
return response.Error(http.StatusNotFound, "org not found", nil)
|
||||
}
|
||||
return response.Error(http.StatusInternalServerError, "Failed to get org", err)
|
||||
}
|
||||
|
||||
return response.JSON(http.StatusOK, dtos.InviteInfo{
|
||||
Email: invite.Email,
|
||||
Name: invite.Name,
|
||||
Username: invite.Email,
|
||||
InvitedBy: util.StringsFallback3(invite.InvitedByName, invite.InvitedByLogin, invite.InvitedByEmail),
|
||||
OrgName: orgResult.Name,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user