mirror of
https://github.com/stashapp/stash.git
synced 2025-12-17 04:14:39 +03:00
Errors for performer/studio non-unique names (#4178)
* Errors for performer/studio non-unique names --------- Co-authored-by: WithoutPants <53250216+WithoutPants@users.noreply.github.com>
This commit is contained in:
@@ -80,6 +80,7 @@ type ValidateModifyReader interface {
|
||||
// 1. The studio exists locally
|
||||
// 2. The studio is not its own ancestor
|
||||
// 3. The studio's aliases are unique
|
||||
// 4. The name is unique
|
||||
func ValidateModify(ctx context.Context, s models.StudioPartial, qb ValidateModifyReader) error {
|
||||
existing, err := qb.Find(ctx, s.ID)
|
||||
if err != nil {
|
||||
@@ -108,6 +109,12 @@ func ValidateModify(ctx context.Context, s models.StudioPartial, qb ValidateModi
|
||||
}
|
||||
}
|
||||
|
||||
if s.Name.Set && s.Name.Value != existing.Name {
|
||||
if err := EnsureStudioNameUnique(ctx, 0, s.Name.Value, qb); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user