Skip to content

DEV: Add validator for enable_discourse_id setting #33710

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 21, 2025

Conversation

pmusaraj
Copy link
Contributor

Still an internal beta feature, but without an id and a secret, the authenticator shouldn't be enabled.

@github-actions github-actions bot added the i18n PRs which update English locale files or i18n related code label Jul 19, 2025
pmusaraj added 2 commits July 19, 2025 20:36
Still an internal beta feature, but without an id and a secret, the
authenticator shouldn't be enabled.
@pmusaraj pmusaraj force-pushed the discourse-id-setting-validator branch from a027d2e to 6b47bfa Compare July 20, 2025 00:36
@pmusaraj pmusaraj requested review from ZogStriP and Copilot July 21, 2025 01:49
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds validation for the enable_discourse_id setting to ensure that the Discourse ID authenticator cannot be enabled without proper credentials configured. The validator checks that both discourse_id_client_id and discourse_id_client_secret are present when attempting to enable the feature.

  • Adds a new validator class EnableDiscourseIdValidator that prevents enabling Discourse ID without credentials
  • Updates site settings configuration to use the new validator
  • Adds localized error message for missing credentials
  • Updates test setup order to configure credentials before enabling the feature

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.

Show a summary per file
File Description
lib/validators/enable_discourse_id_validator.rb New validator class that checks for required credentials before allowing enable_discourse_id to be set to true
config/site_settings.yml Associates the new validator with the enable_discourse_id setting
config/locales/server.en.yml Adds error message for missing Discourse ID credentials
spec/lib/validators/enable_discourse_id_validator_spec.rb Comprehensive test coverage for the new validator
spec/system/discourse_id_spec.rb Updates test setup order to configure credentials before enabling
spec/services/discourse_id/revoke_spec.rb Updates test setup order to configure credentials before enabling
spec/requests/discourse_id_controller_spec.rb Updates test setup order to configure credentials before enabling
spec/lib/auth/discourse_id_authenticator_spec.rb Updates test setup order to configure credentials before enabling

Copy link
Member

@ZogStriP ZogStriP left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@pmusaraj pmusaraj merged commit ecb4ece into main Jul 21, 2025
26 of 28 checks passed
@pmusaraj pmusaraj deleted the discourse-id-setting-validator branch July 21, 2025 12:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
i18n PRs which update English locale files or i18n related code
Development

Successfully merging this pull request may close these issues.

2 participants