[v9.0.x] SearchV2 - Fix starred dashboards for new organizations error (#49649)

Co-authored-by: Ryan McKinley <ryantxu@gmail.com>
Co-authored-by: Maria Alexandra <239999+axelavargas@users.noreply.github.com>
This commit is contained in:
Grot (@grafanabot)
2022-05-25 21:10:21 +02:00
committed by GitHub
co-authored by Ryan McKinley Maria Alexandra
parent 4bd6f62dfd
commit 4a6b94ae8e
+4 -3
View File
@@ -27,10 +27,11 @@ func (hs *HTTPServer) GetStars(c *models.ReqContext) response.Response {
OrgId: c.OrgId,
}
err := hs.dashboardService.GetDashboard(c.Req.Context(), query)
if err != nil {
return response.Error(500, "Failed to get dashboard", err)
// Grafana admin users may have starred dashboards in multiple orgs. This will avoid returning errors when the dashboard is in another org
if err == nil {
uids = append(uids, query.Result.Uid)
}
uids = append(uids, query.Result.Uid)
}
return response.JSON(200, uids)
}