Skip to content
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

FIX: Move misplaced error translation #574

Merged
merged 1 commit into from
May 24, 2024

Conversation

Drenmi
Copy link
Contributor

@Drenmi Drenmi commented May 24, 2024

What is this fix?

I am trying to enable i18n.raise_on_missing_translations in core. It caught a misplaced translation in this plugin. The key and the error message are there, but not nested in the right place.

Before:

Run options: include {:locations=>{"./plugins/discourse-calendar/spec/integration/post_spec.rb"=>[509]}}

Randomized with seed 20522
F

Failures:

  1) Post with a private event when updating raw_invitees doesn’t accept usernames
     Failure/Error:
       expect { event_1.update_with_params!(raw_invitees: [lurker_1.username]) }.to raise_error(
         ActiveRecord::RecordInvalid,
       )
     
       expected ActiveRecord::RecordInvalid, got #<I18n::MissingTranslationData: Translation missing: en.discourse_calendar.discourse_post_event.errors.models.event.raw_invitees.only_group> with backtrace:
         # ./lib/freedom_patches/translate_accelerator.rb:150:in `translate_no_override'
         # ./lib/freedom_patches/translate_accelerator.rb:227:in `translate'
         # /Users/drenmi/Workspace/Discourse/discourse-calendar/app/models/discourse_post_event/event.rb:144:in `raw_invitees_are_groups'
         # /Users/drenmi/Workspace/Discourse/discourse-calendar/app/models/discourse_post_event/event.rb:355:in `update_with_params!'
         # ./plugins/discourse-calendar/spec/integration/post_spec.rb:510:in `block (5 levels) in <main>'
         # ./plugins/discourse-calendar/spec/integration/post_spec.rb:510:in `block (4 levels) in <main>'
         # ./spec/rails_helper.rb:460:in `block (2 levels) in <top (required)>'
     # ./plugins/discourse-calendar/spec/integration/post_spec.rb:510:in `block (4 levels) in <main>'
     # ./spec/rails_helper.rb:460:in `block (2 levels) in <top (required)>'

Finished in 1.53 seconds (files took 2.79 seconds to load)
1 example, 1 failure

Failed examples:

rspec ./plugins/discourse-calendar/spec/integration/post_spec.rb:509 # Post with a private event when updating raw_invitees doesn’t accept usernames

Randomized with seed 20522

After:

Run options: include {:locations=>{"./plugins/discourse-calendar/spec/integration/post_spec.rb"=>[509]}}

Randomized with seed 43832
.

Finished in 1.59 seconds (files took 2.84 seconds to load)
1 example, 0 failures

@Drenmi Drenmi merged commit d7dca57 into main May 24, 2024
5 checks passed
@Drenmi Drenmi deleted the fix/move-misplaced-error-translation branch May 24, 2024 09:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants