Popup message and Text customization issue after upgrade

AI-generated summary

After upgrading to Discourse version 3.1.0.beta2, users encountered a bug where text customization for chat-related messages fails when the default locale is not English. ProjeDEV reported that while English works fine, other languages like Spanish cause errors—specifically a 500 error when attempting to edit js.chat.retention_reminders.dm via the UI, even after fresh installs or safe mode. JammyDodger reproduced the issue, confirming that editing the text post-upgrade triggers a NoMethodError due to interpolation key validation failures. Attempts to revert or manually edit the text failed, and the UI only showed two translation options in Spanish versus three in English. gerhard initially suggested a workaround similar to another known issue, but ProjeDEV confirmed it didn’t work. Later, gerhard advised reverting the customized string via UI, which partially resolved the issue for some, but ProjeDEV still saw incorrect rendering. gerhard acknowledged a separate bug (fixed via PR #20374) and asked ProjeDEV to file a new report for the remaining issue. The core problem appears tied to locale-specific translation handling post-upgrade, affecting chat retention message customization.

I updated a few days ago. After the upgrade, I encountered a problem.

If “default locale” is in English, there is no problem. The popup message is displayed successfully, but in other languages you encounter issues.
I cannot change some texts related to the chat section. By the way, I tried and I can make changes in other parts. I’m not sure if this problem is only related to the chat part or if there are other areas as well.
I faced the same problem whether I did the update from the interface or with the command.
I tried again today. I uninstalled everything and did a fresh install.
I have a fresh install and no plugins or components are installed.

Version : 3.1.0.beta2 -(6fa9a8990d)

Any idea, please ?



1 Like

I’ve just given this a run-through of my test site and I can repro this. I hadn’t updated my test site for a little while and on version f19044af6a it worked fine, but updating to latest 39be3cb619 gave the same behaviour as reported.

My step-by-step:

(Version f19044af6a)

  • Set default locale to ‘Español’
  • Set chat dm retention days to ‘30’
  • Go to /admin/customize/site_texts and edit js.chat.retention_reminders.dm
  • Refresh and check the message with a new test user:

Update to 39be3cb619

  • Existing message has raw parameter value:

  • Go to /admin/customize/site_texts and edit js.chat.retention_reminders.dm now gives an error 500 with this in the logs:

Message (4 copies reported)

NoMethodError (undefined method `scan' for {:one=>"Personal chat history is retained for %{count} day.", :other=>"Personal chat history is retained for %{count} days."}:Hash

    keys = text.scan(pattern)
               ^^^^^)
lib/i18n/i18n_interpolation_keys_finder.rb:6:in `find'
app/models/translation_override.rb:124:in `check_interpolation_keys'
app/models/translation_override.rb:65:in `upsert!'
app/controllers/admin/site_texts_controller.rb:88:in `update'
app/controllers/application_controller.rb:414:in `block in with_resolved_locale'
app/controllers/application_controller.rb:414:in `with_resolved_locale'
lib/middleware/omniauth_bypass_middleware.rb:74:in `call'
lib/content_security_policy/middleware.rb:12:in `call'
lib/middleware/anonymous_cache.rb:369:in `call'
config/initializers/100-quiet_logger.rb:20:in `call'
config/initializers/100-silence_logger.rb:29:in `call'
lib/middleware/enforce_hostname.rb:24:in `call'
lib/middleware/request_tracker.rb:228:in `call'

Backtrace

lib/i18n/i18n_interpolation_keys_finder.rb:6:in `find'
app/models/translation_override.rb:124:in `check_interpolation_keys'
activesupport (7.0.4.1) lib/active_support/callbacks.rb:400:in `block in make_lambda'
activesupport (7.0.4.1) lib/active_support/callbacks.rb:199:in `block (2 levels) in halting'
activesupport (7.0.4.1) lib/active_support/callbacks.rb:687:in `block (2 levels) in default_terminator'
activesupport (7.0.4.1) lib/active_support/callbacks.rb:686:in `catch'
activesupport (7.0.4.1) lib/active_support/callbacks.rb:686:in `block in default_terminator'
activesupport (7.0.4.1) lib/active_support/callbacks.rb:200:in `block in halting'
activesupport (7.0.4.1) lib/active_support/callbacks.rb:595:in `block in invoke_before'
activesupport (7.0.4.1) lib/active_support/callbacks.rb:595:in `each'

3 Likes

And there is no way to correct this situation from the UI alone @JammyDodger ?

1 Like

I’m pretty sure a solution similar to Cannot update text for js.composer.error.post_length - #2 by gerhard will work.

3 Likes

I think it’s a little different from the one in the link you mentioned. You see the problem if your default locale is not english and if you change “chat dm retention days” 0 to x days .
Also, the solution you mentioned doesn’t work , you can not change the text (js.chat.retention_reminders.dm) even in safe mode. There’s 500 Error when you try to change.

2 Likes

I tried a few ways, but I couldn’t get it to reset and let me back in to change it manually. Checking back on it now, the text has reverted to its default text but with the raw variable (so no ‘revert’ option available) and trying to edit manually throws the 500 error. I also tried the safe mode workaround for the other topic, which didn’t seem to have any effect.

Searching for js.chat.retention_reminders.dm in English (UK) locale gives me three choices, but in Español it only offers two.

2 Likes

We’ve updated the translations, so after updating your Discourse to latest, you should be able to fix this in the UI:

You can fix your customized string by going to Customize → Text:

  • Search for “js.chat.retention_reminders.dm”
  • click “edit”
  • click “revert changes” and confirm the question with “yes”
  • click “back to search”
  • Search for “js.chat.retention_reminders.dm”
  • You will see 3 results, customize those strings to your liking
7 Likes

Sorry for bad news…

1 Like

Were you able to revert the customized “js.chat.retention_reminders.dm” string? I’d like to close this bug if that solved it for you.

Well, issue #2 is my bad. I’ll fix that. FIX: Wrong interpolation key by gschlager · Pull Request #20374 · discourse/discourse · GitHub

Issue #1 is a different problem. Would you mind creating a new bug report for that?

4 Likes

Sure, I’m creating right away :+1:

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.