Multiple image URLs (#4000)

* Backend changes - ported from scene impl
* Front end changes
* Refactor URL mutation code
This commit is contained in:
WithoutPants
2023-09-12 13:31:53 +10:00
committed by GitHub
parent 9f4d0af886
commit a25286bdcb
29 changed files with 457 additions and 173 deletions

View File

@@ -1113,6 +1113,19 @@ func getImageStringValue(index int, field string) string {
return fmt.Sprintf("image_%04d_%s", index, field)
}
func getImageNullStringPtr(index int, field string) *string {
return getStringPtrFromNullString(getPrefixedNullStringValue("image", index, field))
}
func getImageEmptyString(index int, field string) string {
v := getImageNullStringPtr(index, field)
if v == nil {
return ""
}
return *v
}
func getImageBasename(index int) string {
return getImageStringValue(index, pathField)
}
@@ -1148,10 +1161,12 @@ func makeImage(i int) *models.Image {
tids := indexesToIDs(tagIDs, imageTags[i])
return &models.Image{
Title: title,
Rating: getIntPtr(getRating(i)),
Date: getObjectDate(i),
URL: getImageStringValue(i, urlField),
Title: title,
Rating: getIntPtr(getRating(i)),
Date: getObjectDate(i),
URLs: models.NewRelatedStrings([]string{
getImageEmptyString(i, urlField),
}),
OCounter: getOCounter(i),
StudioID: studioID,
GalleryIDs: models.NewRelatedIDs(gids),