bug: Disallow spaces and reserved keywords and enforce custom language to be in lowercase in Code Playground settings #36748
+23
−2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds validation logic to the "Add a new code playground" form in the organization settings. It ensures that the language identifier provided by the user is valid and compatible with Zulip's markdown syntax.
Specifically, this change:
latex,math,quote,spoiler) that are used for other Markdown features.Pythonbecomespython).Fixes: #24044
How changes were tested:
Manually verified in the development environment:
test space) , confirmed that a red error message appears ("Language name cannot contain spaces.").math) , confirmed that a red error message appears ("This is a special keyword and cannot be used.").MyLang) , confirmed that it saves successfully and appears in the list asmylang(lowercase).Screenshots and screen captures:
spaces.no.fix.mov
spaces.fixed.mov
keywords.not.fix.mov
keywords.fixed.mov
lowercase.no.fix.mov
lowercase.fixed.mov
Self-review checklist
(variable names, code reuse, readability, etc.).
Communicate decisions, questions, and potential concerns.
Individual commits are ready for review (see commit discipline).
Completed manual review and testing of the following: