Alerting: Use URLs in image annotations (#66804)
* use tokens or urls in image annotations * improve tests, fix some comments * fix empty tokens * code review changes, check for url before checking for token (support old token formats)
This commit is contained in:
@@ -49,6 +49,18 @@ func (s *FakeImageStore) GetImage(_ context.Context, token string) (*models.Imag
|
||||
return nil, models.ErrImageNotFound
|
||||
}
|
||||
|
||||
func (s *FakeImageStore) GetImageByURL(_ context.Context, url string) (*models.Image, error) {
|
||||
s.mtx.Lock()
|
||||
defer s.mtx.Unlock()
|
||||
for _, image := range s.images {
|
||||
if image.URL == url {
|
||||
return image, nil
|
||||
}
|
||||
}
|
||||
|
||||
return nil, models.ErrImageNotFound
|
||||
}
|
||||
|
||||
func (s *FakeImageStore) GetImages(_ context.Context, tokens []string) ([]models.Image, []string, error) {
|
||||
s.mtx.Lock()
|
||||
defer s.mtx.Unlock()
|
||||
|
||||
Reference in New Issue
Block a user