Skip to content

Implement server-side language validation on exercise description steps#1189

Merged
rolandgeider merged 2 commits intowger-project:masterfrom
umaidshahid:feature/930-validate-language-on-step-continue
May 7, 2026
Merged

Implement server-side language validation on exercise description steps#1189
rolandgeider merged 2 commits intowger-project:masterfrom
umaidshahid:feature/930-validate-language-on-step-continue

Conversation

@umaidshahid
Copy link
Copy Markdown
Contributor

@umaidshahid umaidshahid commented May 3, 2026

The validateLanguage stub in AddExerciseProvider was making the API call but ignoring the response and always returning false. This wires it up properly: the method now returns null on success or the server's error message on a language mismatch (caught from the 400 WgerHttpException). The stepper's onStepContinue is now async-aware for steps 2 (Description) and 3 (Translation) — it calls validateLanguage after form validation passes, blocks navigation, and displays the error inline if the check fails. Mocks regenerated to reflect the return type change from Future<bool> to Future<String?>.

Proposed Changes

  • Fix validateLanguage stub to parse the API response and return the server's error message on language mismatch
  • Wire language validation into stepper navigation for the Description and Translation steps, blocking progress and showing the error inline
  • Update mocks to reflect the Future<bool>Future<String?> return type change

Related Issue(s)

closes #930

Please check that the PR fulfills these requirements

  • Tests for the changes have been added (for bug fixes / features)
  • Set a 100-character limit to avoid white space diffs (run dart format .)

Closes wger-project#930. The validateLanguage stub in AddExerciseProvider was making
the API call but ignoring the response and always returning false. This
wires it up properly: the method now returns null on success or the
server's error message on a language mismatch (caught from the 400
WgerHttpException). The stepper's onStepContinue is now async-aware for
steps 2 (Description) and 3 (Translation) — it calls validateLanguage
after form validation passes, blocks navigation, and displays the error
inline if the check fails. Mocks regenerated to reflect the return type
change from Future<bool> to Future<String?>.
@umaidshahid umaidshahid force-pushed the feature/930-validate-language-on-step-continue branch from 03beee2 to f62c6b2 Compare May 3, 2026 22:58
@rolandgeider rolandgeider merged commit 89797c4 into wger-project:master May 7, 2026
1 check passed
@rolandgeider
Copy link
Copy Markdown
Member

merged, thanks!

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.

Add server side validation to exercise comments

2 participants