Fix performer tagger field updating (#1977)

* Fix performer tagger field updating
This commit is contained in:
InfiniteTF 2021-11-11 01:34:46 +01:00 committed by GitHub
parent 07dbc2236d
commit 808202ba8a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 20 additions and 7 deletions

View File

@ -600,6 +600,10 @@ func performerFragmentToScrapedScenePerformer(p graphql.PerformerFragment) *mode
sp.EyeColor = enumToStringPtr(p.EyeColor, true)
}
if p.HairColor != nil {
sp.HairColor = enumToStringPtr(p.HairColor, true)
}
if p.BreastType != nil {
sp.FakeTits = enumToStringPtr(p.BreastType, true)
}

View File

@ -1,5 +1,5 @@
import React, { useState } from "react";
import { Button } from "react-bootstrap";
import { Button, Row, Col } from "react-bootstrap";
import { useIntl } from "react-intl";
import { Modal, Icon } from "src/components/Shared";
@ -30,7 +30,7 @@ const PerformerFieldSelect: React.FC<IProps> = ({
});
const renderField = (name: string) => (
<div className="mb-1" key={name}>
<Col xs={6} className="mb-1" key={name}>
<Button
onClick={() => toggleField(name)}
variant="secondary"
@ -39,7 +39,7 @@ const PerformerFieldSelect: React.FC<IProps> = ({
<Icon icon={excluded[name] ? "times" : "check"} />
</Button>
<span className="ml-3">{TextUtils.capitalize(name)}</span>
</div>
</Col>
);
return (
@ -57,7 +57,7 @@ const PerformerFieldSelect: React.FC<IProps> = ({
<div className="mb-2">
These fields will be tagged by default. Click the button to toggle.
</div>
{fields.map((f) => renderField(f))}
<Row>{fields.map((f) => renderField(f))}</Row>
</Modal>
);
};

View File

@ -115,7 +115,9 @@ const PerformerModal: React.FC<IPerformerModalProps> = ({
throw new Error("performer name must set");
}
const performerData: GQL.PerformerCreateInput = {
const performerData: GQL.PerformerCreateInput & {
[index: string]: unknown;
} = {
name: performer.name ?? "",
aliases: performer.aliases,
gender: stringToGender(performer.gender ?? undefined, true),
@ -162,8 +164,8 @@ const PerformerModal: React.FC<IPerformerModalProps> = ({
// handle exclusions
Object.keys(performerData).forEach((k) => {
if (excluded[k]) {
(performerData as Record<string, unknown>)[k] = undefined;
if (excluded[k] || !performerData[k]) {
performerData[k] = undefined;
}
});

View File

@ -60,10 +60,17 @@ export const PERFORMER_FIELDS = [
"ethnicity",
"country",
"eye_color",
"hair_color",
"height",
"measurements",
"fake_tits",
"career_length",
"tattoos",
"piercings",
"url",
"twitter",
"instagram",
"details",
"death_date",
"weight",
];