Chore: Use context.Context for the get home dashboard API endpoint (#36735)

Use context.Context for the get home dashboard API endpoint.

Ref #36734
This commit is contained in:
Marcus Efraimsson
2021-07-16 12:40:03 +02:00
committed by GitHub
parent e2c64ae228
commit 11d03f7961
8 changed files with 79 additions and 65 deletions
+2 -2
View File
@@ -423,7 +423,7 @@ func (hs *HTTPServer) GetHomeDashboard(c *models.ReqContext) response.Response {
prefsQuery := models.GetPreferencesWithDefaultsQuery{User: c.SignedInUser}
homePage := hs.Cfg.HomePage
if err := hs.Bus.Dispatch(&prefsQuery); err != nil {
if err := hs.Bus.DispatchCtx(c.Req.Context(), &prefsQuery); err != nil {
return response.Error(500, "Failed to get preferences", err)
}
@@ -434,7 +434,7 @@ func (hs *HTTPServer) GetHomeDashboard(c *models.ReqContext) response.Response {
if prefsQuery.Result.HomeDashboardId != 0 {
slugQuery := models.GetDashboardRefByIdQuery{Id: prefsQuery.Result.HomeDashboardId}
err := hs.Bus.Dispatch(&slugQuery)
err := hs.Bus.DispatchCtx(c.Req.Context(), &slugQuery)
if err == nil {
url := models.GetDashboardUrl(slugQuery.Result.Uid, slugQuery.Result.Slug)
dashRedirect := dtos.DashboardRedirect{RedirectUri: url}