From 4a6b94ae8e013ab19ee90f914aa71c8390318915 Mon Sep 17 00:00:00 2001 From: "Grot (@grafanabot)" <43478413+grafanabot@users.noreply.github.com> Date: Wed, 25 May 2022 15:10:21 -0400 Subject: [PATCH] [v9.0.x] SearchV2 - Fix starred dashboards for new organizations error (#49649) Co-authored-by: Ryan McKinley Co-authored-by: Maria Alexandra <239999+axelavargas@users.noreply.github.com> --- pkg/api/stars.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pkg/api/stars.go b/pkg/api/stars.go index 15194d95938..73eeae19ab1 100644 --- a/pkg/api/stars.go +++ b/pkg/api/stars.go @@ -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) }