Short URL: Update last seen at when visiting a short URL (#28565) (#28573)

Ref #28248

Co-authored-by: Sofia Papagiannaki <papagian@users.noreply.github.com>
(cherry picked from commit 60d40fa99b)

Co-authored-by: Marcus Efraimsson <marcus.efraimsson@gmail.com>
This commit is contained in:
Grot (@grafanabot)
2020-10-27 12:16:56 -04:00
committed by GitHub
co-authored by Marcus Efraimsson
parent 23ae63913f
commit 5bb203df99
3 changed files with 39 additions and 0 deletions
+5
View File
@@ -57,6 +57,11 @@ func (hs *HTTPServer) redirectFromShortURL(c *models.ReqContext) {
return
}
// Failure to update LastSeenAt should still allow to redirect
if err := hs.ShortURLService.UpdateLastSeenAt(c.Req.Context(), shortURL); err != nil {
hs.log.Error("Failed to update short URL last seen at", "error", err)
}
hs.log.Debug("Redirecting short URL", "path", shortURL.Path)
c.Redirect(setting.ToAbsUrl(shortURL.Path), 302)
}