Skip to content

Fix CAPTCHA modal not displaying when setting issue non-confidential

Chad Woolley requested to merge 334707-fix-captcha-for-set-confidential into master

What does this MR do?

Fixes CAPTCHA modal not displaying when setting issue non-confidential.

This is a case where we were supposed to have spam protection but we didn't (or maybe used to but lost it through refactorings).

This bug was "introduced" by !58603 (diffs) , but only in the sense that the backend is now performing the spam check properly, but not fully handling the CAPTCHA display if spam was detected.

More technical context:

The original bug (that switching to non-confidential didn't perform a spam check like it should) was actually related to the passing of the request to the service layer (or not, in this case).

It was never obvious to most people why the request was needed to be passed to the service layer, or that this was what actually triggered the spam checking, or that that was the only purpose of the request being passed into the service layer.

In this case, I missed adding this extra necessary line during my refactor because I was looking for existing places where the request was passed, but this mutation was never properly passing the request to the service in the first place.

The good news is the recent refactors have now removed this unnecessary and confusing coupling of the HTTP request to the service layer, and now it's very explicit and typesafe. You have to pass spam_params to the service constructors, and if it is nil theres not gonna be any check :)

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

See the following section of the CAPTCHA epic for notes on how to test CAPTCHA locally: https://gitlab.com/groups/gitlab-org/-/epics/5527#testing-notes

Resolves #334707 (closed)

Edited by Chad Woolley

Merge request reports