Skip to content

fix: do not animate non-existing captcha modal#1869

Merged
KernelDeimos merged 3 commits intomainfrom
eric/25AU3-fix-temp-user
Oct 30, 2025
Merged

fix: do not animate non-existing captcha modal#1869
KernelDeimos merged 3 commits intomainfrom
eric/25AU3-fix-temp-user

Conversation

@KernelDeimos
Copy link
Copy Markdown
Contributor

Calling .fadeOut() on the result of a jquery selector (i.e. the evaluation of $('.some-element-class'), when it returns an object with length=0) is a NOOP. That's right, it doesn't throw an error; it just does nothing. This was preventing a temporary user from being created when .captcha-modal isn't present because [the code intended to execute after the animation] was never run. (square brackets for clarity because the English is inherently ambiguous)

Calling `.fadeOut()` on the result of a jquery selector (i.e. the
evaluation of `$('.some-element-class')`, when it returns an object with
`length=0`) is a NOOP. That's right, it doesn't throw an error; it just
does nothing. This was preventing a temporary user from being created
when `.captcha-modal` isn't present because [the code intended to execute
after the animation] was never run. (square brackets for clarity because
the English is inherently ambiguous)
Apparently the callback operand of $.fn.fadeOut may be called more than
once if there are multiple matching elements. Although we expect there
to only be one element matching the selector `".captcha-modal"`, someone
editing the CSS and HTML would not expect such consequences to the
logic of captcha.
This commit reduces the indentation level and complex arithmetic inside
the createTempUser function in initgui. It is suspected that this change
should greatly reduce measures of the "cognitive complexity" metric.
@KernelDeimos KernelDeimos merged commit e37e009 into main Oct 30, 2025
5 of 6 checks passed
@jelveh jelveh deleted the eric/25AU3-fix-temp-user branch May 1, 2026 20:01
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.

1 participant