Make title optional for non-user created galleries (#3110)

This commit is contained in:
WithoutPants
2022-11-10 14:19:13 +11:00
committed by GitHub
parent c83ebf7c1c
commit 9df66024d1
4 changed files with 15 additions and 3 deletions

View File

@@ -37,6 +37,12 @@ type Gallery struct {
PerformerIDs RelatedIDs `json:"performer_ids"`
}
// IsUserCreated returns true if the gallery was created by the user.
// This is determined by whether the gallery has a primary file or folder.
func (g *Gallery) IsUserCreated() bool {
return g.PrimaryFileID == nil && g.FolderID == nil
}
func (g *Gallery) LoadFiles(ctx context.Context, l FileLoader) error {
return g.Files.load(func() ([]file.File, error) {
return l.GetFiles(ctx, g.ID)