Greenlight: Problem to access to profile page

Created on 19 Apr 2020  路  5Comments  路  Source: bigbluebutton/greenlight

There is a regression to access to profile page.
This issue didn't appear with old greenlight version (2 weeks ago).
But today I tried to install greenlight and I found this problem.

image

bug

Most helpful comment

Problem seems to be this commit: https://github.com/bigbluebutton/greenlight/commit/3b8b1abb59f56c4ee4b4316d559c2205b7a808ee

tl;dr
The commit added a new language whichs short code is not known to the greenlight. This crashed when the list of available languages is shown.

long version:

greenlight automatically adds the "hy" language to Rails.configuration.i18n.available_locales (here) and later uses it here to render the list of available languages. But the i18n-language-mapping gem does not support this language (https://github.com/blindsidenetworks/i18n-language-mapping/blob/master/lib/i18n/language/mapping.rb)

Quickfix: Delete the hy.yml file and redeploy greenlight
Proper fix: Add hy to the i18n-language-mapping gem and/or properly handling missing language mappings

All 5 comments

Can confirm this. From production.log:

method=GET path=/b/u/gl-ktcqznuvbemh/edit format=html controller=UsersController action=edit status=500 error='ActionView::Template::Error: undefined method `[]' for nil:NilClass' duration=63.03 view=0.00 db=5.28 host=greenlight 
ActionView::Template::Error (undefined method `[]' for nil:NilClass): 
36:     <%= f.text_field :provider, class: "form-control", readonly: "" %>
37:     <br>
38:     <%= f.label t("settings.account.language"), class: "form-label" %>
39:     <%= f.select :language, language_options, {}, { class: "form-control custom-select" } %>
40: 
41:     <% current_user_role = current_user.highest_priority_role %>
42:     <br> 
app/helpers/users_helper.rb:50:in `block in language_options'
app/helpers/users_helper.rb:48:in `each'
app/helpers/users_helper.rb:48:in `language_options'
app/views/users/components/_account.html.erb:39:in `block in _app_views_users_components__account_html_erb__1922620160339889164_47060312780400'
app/views/users/components/_account.html.erb:16:in `_app_views_users_components__account_html_erb__1922620160339889164_47060312780400'
app/views/users/components/_setting_view.html.erb:24:in `block in _app_views_users_components__setting_view_html_erb__1462585977136171657_47060312797040'
app/views/users/components/_setting_view.html.erb:16:in `_app_views_users_components__setting_view_html_erb__1462585977136171657_47060312797040'
app/views/users/edit.html.erb:32:in `_app_views_users_edit_html_erb___396747478642196272_47060312847960' 
INFO: [8d57ac98-d37b-4690-a171-f04acdca385c] method=GET path=/b/500 format=html controller=ErrorsController action=internal_error status=500 duration=32.31 view=25.67 db=0.10 host=greenlight

This also prevents the admin from changing settings of other users.

A temporary work-around is to comment some lines in greenlight/app/helpers/users_helper.rb so that the only the browser language is used:

# Returns language selection options for user edit
def language_options
  language_opts = [['<<<< ' + t("language_default") + ' >>>>', "default"]]
  language_opts.sort
end

Problem seems to be this commit: https://github.com/bigbluebutton/greenlight/commit/3b8b1abb59f56c4ee4b4316d559c2205b7a808ee

tl;dr
The commit added a new language whichs short code is not known to the greenlight. This crashed when the list of available languages is shown.

long version:

greenlight automatically adds the "hy" language to Rails.configuration.i18n.available_locales (here) and later uses it here to render the list of available languages. But the i18n-language-mapping gem does not support this language (https://github.com/blindsidenetworks/i18n-language-mapping/blob/master/lib/i18n/language/mapping.rb)

Quickfix: Delete the hy.yml file and redeploy greenlight
Proper fix: Add hy to the i18n-language-mapping gem and/or properly handling missing language mappings

Also we have config.i18n.available_locales = [:en] in config/application.rb' which redefine byconfig/initializers/languages.rb' and not working. I thing if we could use config.i18n.available_locales to limit set of languages, we may keep any file in config/locales. Am i right?

Fixed by #1361

need to restore hy.yml (if you don't) otherwise controller=ErrorsController action=internal_error status=500 error='I18n::InvalidLocaleData: can not load translations from /usr/src/app/config/locales/hy.yml: expects it to return a hash, but does not'

Was this page helpful?
0 / 5 - 0 ratings