mirror of
https://github.com/wisplite/raster.git
synced 2026-05-01 06:32:44 -05:00
fix navbar and guest user checks
previously guest users would cause a response 500 if a private album existed, meaning they couldn't see any albums they also couldn't load media in any album due to requiring an access token
This commit is contained in:
@@ -83,6 +83,15 @@ func GetAllMediaInAlbum(albumID string, accessToken string) ([]models.Media, err
|
||||
return media, nil
|
||||
}
|
||||
|
||||
func GetAllMediaInPublicAlbum(albumID string) ([]models.Media, error) {
|
||||
media := []models.Media{}
|
||||
result := db.GetDB().Where("album_id = ?", albumID).Find(&media)
|
||||
if result.Error != nil {
|
||||
return []models.Media{}, result.Error
|
||||
}
|
||||
return media, nil
|
||||
}
|
||||
|
||||
func GetMedia(albumID string, mediaID string) (models.Media, error) {
|
||||
media := models.Media{}
|
||||
result := db.GetDB().First(&media, "album_id = ? AND id = ?", albumID, mediaID)
|
||||
|
||||
Reference in New Issue
Block a user