Skip to content

Commit

Permalink
Check for null disambiguation on validate (stashapp#5019)
Browse files Browse the repository at this point in the history
  • Loading branch information
dogwithakeyboard authored Jun 27, 2024
1 parent af6841b commit b7f9385
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
12 changes: 8 additions & 4 deletions pkg/performer/validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,15 @@ func validateName(ctx context.Context, name string, disambig string, existingID
},
}

modifier := models.CriterionModifierIsNull

if disambig != "" {
performerFilter.Disambiguation = &models.StringCriterionInput{
Value: disambig,
Modifier: models.CriterionModifierEquals,
}
modifier = models.CriterionModifierEquals
}

performerFilter.Disambiguation = &models.StringCriterionInput{
Value: disambig,
Modifier: modifier,
}

if existingID == nil {
Expand Down
10 changes: 3 additions & 7 deletions pkg/performer/validate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ func nameFilter(n string) *models.PerformerFilterType {
Value: n,
Modifier: models.CriterionModifierEquals,
},
Disambiguation: &models.StringCriterionInput{
Modifier: models.CriterionModifierIsNull,
},
}
}

Expand All @@ -41,13 +44,6 @@ func TestValidateName(t *testing.T) {
newName = "new name"
newDisambig = "new disambiguation"
)
// existing1 := models.Performer{
// Name: name1,
// }
// existing2 := models.Performer{
// Name: name2,
// Disambiguation: disambig,
// }

pp := 1
findFilter := &models.FindFilterType{
Expand Down

0 comments on commit b7f9385

Please sign in to comment.