mirror of
https://git.vectorsigma.ru/public/photoview.git
synced 2026-08-03 18:29:17 +00:00
Replace all gorm .Scan() calls with .Find()
if the argument is a model. This ensures that the proper gorm hooks are called which was causing the full screen view on the Places page to crash. Also fixed a bug in Messages.js that caused a crash.
This commit is contained in:
@@ -35,7 +35,7 @@ func (r *queryResolver) MyMedia(ctx context.Context, order *models.Ordering, pag
|
||||
|
||||
query = models.FormatSQL(query, order, paginate)
|
||||
|
||||
if err := query.Scan(&media).Error; err != nil {
|
||||
if err := query.Find(&media).Error; err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -91,7 +91,7 @@ func (r *queryResolver) MediaList(ctx context.Context, ids []int) ([]*models.Med
|
||||
Joins("LEFT JOIN user_albums ON user_albums.album_id = media.album_id").
|
||||
Where("media.id IN ?", ids).
|
||||
Where("user_albums.user_id = ?", user.ID).
|
||||
Scan(&media).Error
|
||||
Find(&media).Error
|
||||
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "could not get media list by media_id and user_id from database")
|
||||
|
||||
Reference in New Issue
Block a user