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
This commit is contained in:
WithoutPants 2024-02-23 14:34:04 +11:00 committed by GitHub
parent 4b84ec0d85
commit 4a3ce8b6ec
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 20 additions and 0 deletions

View file

@ -162,6 +162,11 @@ func (j *autoTagJob) autoTagPerformers(ctx context.Context, progress *job.Progre
return fmt.Errorf("performer with id %s not found", performerId) 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 { if err := performer.LoadAliases(ctx, r.Performer); err != nil {
return fmt.Errorf("loading aliases for performer %d: %w", performer.ID, err) 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) 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) 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) 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) tags = append(tags, tag)
} }

View file

@ -380,6 +380,7 @@ const PerformerPage: React.FC<IProps> = ({ performer, tabKey }) => {
onToggleEdit={() => toggleEditing()} onToggleEdit={() => toggleEditing()}
onDelete={onDelete} onDelete={onDelete}
onAutoTag={onAutoTag} onAutoTag={onAutoTag}
autoTagDisabled={performer.ignore_auto_tag}
isNew={false} isNew={false}
isEditing={false} isEditing={false}
onSave={() => {}} onSave={() => {}}

View file

@ -13,6 +13,7 @@ interface IProps {
saveDisabled?: boolean; saveDisabled?: boolean;
onDelete: () => void; onDelete: () => void;
onAutoTag?: () => void; onAutoTag?: () => void;
autoTagDisabled?: boolean;
onImageChange: (event: React.FormEvent<HTMLInputElement>) => void; onImageChange: (event: React.FormEvent<HTMLInputElement>) => void;
onBackImageChange?: (event: React.FormEvent<HTMLInputElement>) => void; onBackImageChange?: (event: React.FormEvent<HTMLInputElement>) => void;
onImageChangeURL?: (url: string) => void; onImageChangeURL?: (url: string) => void;
@ -94,6 +95,7 @@ export const DetailsEditNavbar: React.FC<IProps> = (props: IProps) => {
<div> <div>
<Button <Button
variant="secondary" variant="secondary"
disabled={props.autoTagDisabled}
onClick={() => { onClick={() => {
if (props.onAutoTag) { if (props.onAutoTag) {
props.onAutoTag(); props.onAutoTag();

View file

@ -502,6 +502,7 @@ const StudioPage: React.FC<IProps> = ({ studio, tabKey }) => {
onImageChange={() => {}} onImageChange={() => {}}
onClearImage={() => {}} onClearImage={() => {}}
onAutoTag={onAutoTag} onAutoTag={onAutoTag}
autoTagDisabled={studio.ignore_auto_tag}
onDelete={onDelete} onDelete={onDelete}
/> />
); );

View file

@ -374,6 +374,7 @@ const TagPage: React.FC<IProps> = ({ tag, tabKey }) => {
onImageChange={() => {}} onImageChange={() => {}}
onClearImage={() => {}} onClearImage={() => {}}
onAutoTag={onAutoTag} onAutoTag={onAutoTag}
autoTagDisabled={tag.ignore_auto_tag}
onDelete={onDelete} onDelete={onDelete}
classNames="mb-2" classNames="mb-2"
customButtons={renderMergeButton()} customButtons={renderMergeButton()}