From 24e96912a47054dca9f631f264db351e2c4da44b Mon Sep 17 00:00:00 2001 From: WithoutPants <53250216+WithoutPants@users.noreply.github.com> Date: Fri, 23 Feb 2024 14:34:04 +1100 Subject: [PATCH] Fix auto tag from object not honouring the ignore autotag flag (#4610) * Fix auto tag from object ignoring the ignore autotag field * Disable auto tag buttons where ignore auto tag is enabled --- internal/manager/task_autotag.go | 15 +++++++++++++++ .../Performers/PerformerDetails/Performer.tsx | 1 + .../src/components/Shared/DetailsEditNavbar.tsx | 2 ++ .../components/Studios/StudioDetails/Studio.tsx | 1 + ui/v2.5/src/components/Tags/TagDetails/Tag.tsx | 1 + 5 files changed, 20 insertions(+) diff --git a/internal/manager/task_autotag.go b/internal/manager/task_autotag.go index e23437651f7..6dc37d56ab6 100644 --- a/internal/manager/task_autotag.go +++ b/internal/manager/task_autotag.go @@ -162,6 +162,11 @@ func (j *autoTagJob) autoTagPerformers(ctx context.Context, progress *job.Progre return fmt.Errorf("performer with id %s not found", performerId) } + if performer.IgnoreAutoTag { + logger.Infof("Skipping performer %s because auto-tag is disabled", performer.Name) + return nil + } + if err := performer.LoadAliases(ctx, r.Performer); err != nil { return fmt.Errorf("loading aliases for performer %d: %w", performer.ID, err) } @@ -253,6 +258,11 @@ func (j *autoTagJob) autoTagStudios(ctx context.Context, progress *job.Progress, return fmt.Errorf("studio with id %s not found", studioId) } + if studio.IgnoreAutoTag { + logger.Infof("Skipping studio %s because auto-tag is disabled", studio.Name) + return nil + } + studios = append(studios, studio) } @@ -345,6 +355,11 @@ func (j *autoTagJob) autoTagTags(ctx context.Context, progress *job.Progress, pa return fmt.Errorf("tag with id %s not found", tagId) } + if tag.IgnoreAutoTag { + logger.Infof("Skipping tag %s because auto-tag is disabled", tag.Name) + return nil + } + tags = append(tags, tag) } diff --git a/ui/v2.5/src/components/Performers/PerformerDetails/Performer.tsx b/ui/v2.5/src/components/Performers/PerformerDetails/Performer.tsx index e390ab5741a..71082965791 100644 --- a/ui/v2.5/src/components/Performers/PerformerDetails/Performer.tsx +++ b/ui/v2.5/src/components/Performers/PerformerDetails/Performer.tsx @@ -380,6 +380,7 @@ const PerformerPage: React.FC = ({ performer, tabKey }) => { onToggleEdit={() => toggleEditing()} onDelete={onDelete} onAutoTag={onAutoTag} + autoTagDisabled={performer.ignore_auto_tag} isNew={false} isEditing={false} onSave={() => {}} diff --git a/ui/v2.5/src/components/Shared/DetailsEditNavbar.tsx b/ui/v2.5/src/components/Shared/DetailsEditNavbar.tsx index fb5646ff571..2eafcbbc51d 100644 --- a/ui/v2.5/src/components/Shared/DetailsEditNavbar.tsx +++ b/ui/v2.5/src/components/Shared/DetailsEditNavbar.tsx @@ -13,6 +13,7 @@ interface IProps { saveDisabled?: boolean; onDelete: () => void; onAutoTag?: () => void; + autoTagDisabled?: boolean; onImageChange: (event: React.FormEvent) => void; onBackImageChange?: (event: React.FormEvent) => void; onImageChangeURL?: (url: string) => void; @@ -94,6 +95,7 @@ export const DetailsEditNavbar: React.FC = (props: IProps) => {