10BC0 bug: Disallow spaces and reserved keywords and enforce custom language to be in lowercase in Code Playground settings by nithyarajmudhaliyar · Pull Request #36748 · zulip/zulip · GitHub
[go: up one dir, main page]

Skip to content

Conversation

@nithyarajmudhaliyar
Copy link
Collaborator
@nithyarajmudhaliyar nithyarajmudhaliyar commented Nov 22, 2025

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:

  1. Disallows spaces in the language name, as these break code block parsing.
  2. Disallows reserved keywords (latex, math, quote, spoiler) that are used for other Markdown features.
  3. Enforces lowercase by automatically converting the input to lowercase before saving, ensuring consistency (e.g., Python becomes python).

Fixes: #24044

How changes were tested:

Manually verified in the development environment:

  1. Tried adding a language with spaces (e.g., test space) , confirmed that a red error message appears ("Language name cannot contain spaces.").
  2. Tried adding a reserved keyword (e.g., math) , confirmed that a red error message appears ("This is a special keyword and cannot be used.").
  3. Tried adding a mixed-case language (e.g., MyLang) , confirmed that it saves successfully and appears in the list as mylang (lowercase).

Screenshots and screen captures:

Before After
spaces.no.fix.mov
spaces.fixed.mov
keywords.not.fix.mov
keywords.fixed.mov
lowercase.no.fix.mov
lowercase.fixed.mov
Self-review checklist
  • Self-reviewed the changes for clarity and maintainability
    (variable names, code reuse, readability, etc.).

Communicate decisions, questions, and potential concerns.

  • Explains differences from previous plans (e.g., issue description).
  • Highlights technical choices and bugs encountered.
  • Calls out remaining decisions and concerns.
  • Automated tests verify logic where appropriate.

Individual commits are ready for review (see commit discipline).

  • Each commit is a coherent idea.
  • Commit message(s) explain reasoning and motivation for changes.

Completed manual review and testing of the following:

  • Visual appearance of the changes.
  • Responsiveness and internationalization.
  • Strings and tooltips.
  • End-to-end functionality of buttons, interactions and flows.
  • Corner cases, error conditions, and easily imagined bugs.

@nithyarajmudhaliyar nithyarajmudhaliyar force-pushed the playground-24044 branch 3 times, most recently from 349e886 to e69bc7a Compare November 22, 2025 10:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Disallow spaces & special keywords in Code Playground language field

2 participants

0