Skip to content

Block scene/performer submits with pending URLs#1123

Open
smith113-p wants to merge 2 commits into
stashapp:masterfrom
smith113-p:error
Open

Block scene/performer submits with pending URLs#1123
smith113-p wants to merge 2 commits into
stashapp:masterfrom
smith113-p:error

Conversation

@smith113-p

Copy link
Copy Markdown
Contributor

When I started contributing to stashdb, I constantly forgot to click the "Add" button when adding a URL to a scene draft.

This PR adds checks to the scene and performer draft forms to ensure that the user actually clicks Add after entering a URL.

Screenshot:
Screenshot 2026-05-29 135225

Drafted with Codex, but I have looked through the code myself and it looks reasonable to me (although my React knowledge is limited)

@Gykes Gykes left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For some reason I have lost the ability to wrap text in blocks. I beleive my key is broken.... sorry.

Just a quick once over. Didn't dig too deep into it.

Comment on lines +171 to +175
onChange={(e) => {
const value = e.currentTarget.value;
setNewURL(value);
onPendingURLChange?.(value.trim().length > 0);
}}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If im reading this correctly the onPendingURLChange notification is wired into onChange. It looks like the existing onPaste handler also calls setNewURL directly if it matches a site. I think if a user pastes in a URL, doesnt add, then saves it will get missed.

Comment on lines +673 to +675
pendingURLError={errors.pendingUrl?.message}
onPendingURLChange={(hasPendingURL) =>
setValue("pendingUrl", hasPendingURL ? "pending" : "", {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Soring pending vs "" to drive a boolean check seems weird to me and potentially a smell down the line. I would make pendingURL a yup.boolean() or store the pending url.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like this is also the same on SceneForm.tsx and schema.ts

Comment on lines +506 to +511
pendingURLError={errors.pendingUrl?.message}
onPendingURLChange={(hasPendingURL) =>
setValue("pendingUrl", hasPendingURL ? "pending" : "", {
shouldValidate: true,
})
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like this is duplicated. My genera rule of thumb is 2+ times to break it out into a hook or a shared component to reduce LOC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] Validate user hasn't forgotten to click 'add' for a link

2 participants