Skip to content

Commit

Permalink
Fix auto tag from object not honouring the ignore autotag flag (stash…
Browse files Browse the repository at this point in the history
…app#4610)

* Fix auto tag from object ignoring the ignore autotag field
* Disable auto tag buttons where ignore auto tag is enabled
  • Loading branch information
WithoutPants authored and halkeye committed Sep 1, 2024
1 parent 40b7198 commit 24e9691
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 0 deletions.
15 changes: 15 additions & 0 deletions internal/manager/task_autotag.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down Expand Up @@ -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)
}

Expand Down Expand Up @@ -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)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,7 @@ const PerformerPage: React.FC<IProps> = ({ performer, tabKey }) => {
onToggleEdit={() => toggleEditing()}
onDelete={onDelete}
onAutoTag={onAutoTag}
autoTagDisabled={performer.ignore_auto_tag}
isNew={false}
isEditing={false}
onSave={() => {}}
Expand Down
2 changes: 2 additions & 0 deletions ui/v2.5/src/components/Shared/DetailsEditNavbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ interface IProps {
saveDisabled?: boolean;
onDelete: () => void;
onAutoTag?: () => void;
autoTagDisabled?: boolean;
onImageChange: (event: React.FormEvent<HTMLInputElement>) => void;
onBackImageChange?: (event: React.FormEvent<HTMLInputElement>) => void;
onImageChangeURL?: (url: string) => void;
Expand Down Expand Up @@ -94,6 +95,7 @@ export const DetailsEditNavbar: React.FC<IProps> = (props: IProps) => {
<div>
<Button
variant="secondary"
disabled={props.autoTagDisabled}
onClick={() => {
if (props.onAutoTag) {
props.onAutoTag();
Expand Down
1 change: 1 addition & 0 deletions ui/v2.5/src/components/Studios/StudioDetails/Studio.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,7 @@ const StudioPage: React.FC<IProps> = ({ studio, tabKey }) => {
onImageChange={() => {}}
onClearImage={() => {}}
onAutoTag={onAutoTag}
autoTagDisabled={studio.ignore_auto_tag}
onDelete={onDelete}
/>
);
Expand Down
1 change: 1 addition & 0 deletions ui/v2.5/src/components/Tags/TagDetails/Tag.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,7 @@ const TagPage: React.FC<IProps> = ({ tag, tabKey }) => {
onImageChange={() => {}}
onClearImage={() => {}}
onAutoTag={onAutoTag}
autoTagDisabled={tag.ignore_auto_tag}
onDelete={onDelete}
classNames="mb-2"
customButtons={renderMergeButton()}
Expand Down

0 comments on commit 24e9691

Please sign in to comment.