feat: added captcha to discussion post creation (#785)

* feat: added captcha to discussion post creation

* feat: added captcha for comment and response

* fix: removed learner check

* test: fixed test cases

* fix: removed comment and added check for empty sitekey

* fix: fixed translation issue

* test: added test cases for recaptcha

* test: should allow posting a comment with CAPTCHA

* test: added submit post test cases

* test: test edge cases for api

* test: added test cases for react-google-recaptcha

* test: added test case for default values for captcha

* fix: removed unused catch

---------

Co-authored-by: sundasnoreen12 <sundasnoreen12@gmail.com>
Co-authored-by: Awais Ansari <awais.ansari63@gmail.com>
This commit is contained in:
Ahtisham Shahid
2025-07-17 18:55:16 +05:00
committed by GitHub
parent 8618e8cfe9
commit 2241575cc0
16 changed files with 614 additions and 19 deletions

View File

@@ -205,6 +205,7 @@ export function createNewThread({
cohort,
enableInContextSidebar,
notifyAllLearners,
recaptchaToken,
}) {
return async (dispatch) => {
try {
@@ -219,6 +220,7 @@ export function createNewThread({
anonymousToPeers,
cohort,
notifyAllLearners,
recaptchaToken,
}));
const data = await postThread(courseId, topicId, type, title, content, {
cohort,
@@ -226,6 +228,7 @@ export function createNewThread({
anonymous,
anonymousToPeers,
notifyAllLearners,
recaptchaToken,
}, enableInContextSidebar);
dispatch(postThreadSuccess(camelCaseObject(data)));
} catch (error) {