AnnotationsApi: GET /api/annotations/:annotationId (#47739)
This commit is contained in:
@@ -351,6 +351,26 @@ func (hs *HTTPServer) MassDeleteAnnotations(c *models.ReqContext) response.Respo
|
||||
return response.Success("Annotations deleted")
|
||||
}
|
||||
|
||||
func (hs *HTTPServer) GetAnnotationByID(c *models.ReqContext) response.Response {
|
||||
annotationID, err := strconv.ParseInt(web.Params(c.Req)[":annotationId"], 10, 64)
|
||||
if err != nil {
|
||||
return response.Error(http.StatusBadRequest, "annotationId is invalid", err)
|
||||
}
|
||||
|
||||
repo := annotations.GetRepository()
|
||||
|
||||
annotation, resp := findAnnotationByID(c.Req.Context(), repo, annotationID, c.SignedInUser)
|
||||
if resp != nil {
|
||||
return resp
|
||||
}
|
||||
|
||||
if annotation.Email != "" {
|
||||
annotation.AvatarUrl = dtos.GetGravatarUrl(annotation.Email)
|
||||
}
|
||||
|
||||
return response.JSON(200, annotation)
|
||||
}
|
||||
|
||||
func (hs *HTTPServer) DeleteAnnotationByID(c *models.ReqContext) response.Response {
|
||||
annotationID, err := strconv.ParseInt(web.Params(c.Req)[":annotationId"], 10, 64)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user