mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Revert "Alerting: Refactor the ImageStore/Provider to provide image URL/bytes" (#69265)
Revert "Alerting: Refactor the ImageStore/Provider to provide image URL/bytes (#67693)"
This reverts commit 72a187b0be.
This commit is contained in:
@@ -31,10 +31,6 @@ type ImageStore interface {
|
||||
|
||||
// SaveImage saves the image or returns an error.
|
||||
SaveImage(ctx context.Context, img *models.Image) error
|
||||
|
||||
// URLExists takes a URL and returns a boolean indicating whether or not
|
||||
// we have an image for that URL.
|
||||
URLExists(ctx context.Context, url string) (bool, error)
|
||||
}
|
||||
|
||||
type ImageAdminStore interface {
|
||||
@@ -79,19 +75,6 @@ func (st DBstore) GetImageByURL(ctx context.Context, url string) (*models.Image,
|
||||
return &image, nil
|
||||
}
|
||||
|
||||
func (st DBstore) URLExists(ctx context.Context, url string) (bool, error) {
|
||||
var exists bool
|
||||
err := st.SQLStore.WithDbSession(ctx, func(sess *db.Session) error {
|
||||
ok, err := sess.Table("alert_image").Where("url = ? AND expires_at > ?", url, TimeNow().UTC()).Exist()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
exists = ok
|
||||
return nil
|
||||
})
|
||||
return exists, err
|
||||
}
|
||||
|
||||
func (st DBstore) GetImages(ctx context.Context, tokens []string) ([]models.Image, []string, error) {
|
||||
var images []models.Image
|
||||
if err := st.SQLStore.WithDbSession(ctx, func(sess *db.Session) error {
|
||||
|
||||
Reference in New Issue
Block a user