From: Peter Amstutz Date: Fri, 20 Nov 2020 20:25:27 +0000 (-0500) Subject: 17154: Make sure most current user record is loaded. X-Git-Tag: 2.2.0~220^2~2 X-Git-Url: https://git.arvados.org/arvados.git/commitdiff_plain/c11f254a98e7caf437422d86eab38c7ba4f04096 17154: Make sure most current user record is loaded. Convert 'option' items (which are symbols) to strings for value comparison Arvados-DCO-1.1-Signed-off-by: Peter Amstutz --- diff --git a/apps/workbench/app/controllers/application_controller.rb b/apps/workbench/app/controllers/application_controller.rb index cf4bfa8c54..6d139cd5fd 100644 --- a/apps/workbench/app/controllers/application_controller.rb +++ b/apps/workbench/app/controllers/application_controller.rb @@ -760,7 +760,7 @@ class ApplicationController < ActionController::Base if current_user && !profile_config.empty? current_user_profile = current_user.prefs[:profile] profile_config.each do |k, entry| - if entry['Required'] + if entry[:Required] if !current_user_profile || !current_user_profile[k] || current_user_profile[k].empty? diff --git a/apps/workbench/app/controllers/users_controller.rb b/apps/workbench/app/controllers/users_controller.rb index 27fc12bf4c..d782bcb400 100644 --- a/apps/workbench/app/controllers/users_controller.rb +++ b/apps/workbench/app/controllers/users_controller.rb @@ -39,6 +39,7 @@ class UsersController < ApplicationController def profile params[:offer_return_to] ||= params[:return_to] + Thread.current[:user] = User.find(current_user.uuid) end def activity diff --git a/apps/workbench/app/views/users/profile.html.erb b/apps/workbench/app/views/users/profile.html.erb index 6692196dab..caa22bda11 100644 --- a/apps/workbench/app/views/users/profile.html.erb +++ b/apps/workbench/app/views/users/profile.html.erb @@ -68,29 +68,30 @@ SPDX-License-Identifier: AGPL-3.0 %> <% profile_config.kind_of?(Array) && profile_config.andand.each do |entry| %> - <% if entry['Key'] %> + <% if entry[:Key] %> <% show_save_button = true - label = entry['Required'] ? '* ' : '' - label += entry['FormFieldTitle'] - value = current_user_profile[entry['Key'].to_sym] if current_user_profile + label = entry[:Required] ? '* ' : '' + label += entry[:FormFieldTitle] + value = current_user_profile[entry[:Key].to_sym] if current_user_profile %>
- - <% if entry['Type'] == 'select' %> + <% if entry[:Type] == 'select' %>
- + <% entry[:Options].each do |option, _| %> + <% option = option.to_s %> <% end %>
<% else %>
- +
<% end %>