Project

General

Profile

Actions

Bug #21169

closed

Fix deprecated ERB usage in account setup email view

Added by Tom Clegg about 1 year ago. Updated 11 months ago.

Status:
Resolved
Priority:
Normal
Assigned To:
Category:
API
Story points:
0.5

Description

As of #20846, testing services/api in Ruby 3 gave the following warnings.

/home/tom/arvados/services/api/app/views/user_notifier/account_is_setup.text.erb:5: warning: Passing safe_level with the 2nd argument of ERB.new is de\
precated. Do not use it, and specify other arguments as keyword arguments.
/home/tom/arvados/services/api/app/views/user_notifier/account_is_setup.text.erb:5: warning: Passing trim_mode with the 3rd argument of ERB.new is dep\
recated. Use keyword argument like ERB.new(str, trim_mode: ...) instead.

However, if we do the obvious thing:

diff --git a/services/api/app/views/user_notifier/account_is_setup.text.erb b/services/api/app/views/user_notifier/account_is_setup.text.erb
index 352ee7754e..e6349922fa 100644
--- a/services/api/app/views/user_notifier/account_is_setup.text.erb
+++ b/services/api/app/views/user_notifier/account_is_setup.text.erb
@@ -2,4 +2,4 @@

 SPDX-License-Identifier: AGPL-3.0 %>

-<%= ERB.new(Rails.configuration.Users.UserSetupMailText, 0, "-").result(binding) %>
+<%= ERB.new(Rails.configuration.Users.UserSetupMailText, safe_level: 0, trim_mode: "-").result(binding) %>

The result is:

UserNotifierTest#test_account_is_setup = 0.54 s = E

Error:                                                                                                                                                 
UserNotifierTest#test_account_is_setup:                                                                                                                
ActionView::Template::Error: unknown keyword: :safe_level                                                                                              
    app/views/user_notifier/account_is_setup.text.erb:5:in `new'                                                                                       
    app/views/user_notifier/account_is_setup.text.erb:5                                                                                                
    app/mailers/user_notifier.rb:14:in `account_is_setup'                                                                                              
    test/unit/user_notifier_test.rb:36:in `block in <class:UserNotifierTest>'                                                                          

Keeping trim_mode: "-" and removing safe_mode: 0 makes the errors and warnings go away, but what are the other implications of removing that?


Related issues

Related to Arvados - Idea #20846: Support Ubuntu 22.04 LTSResolvedBrett Smith10/30/2023Actions
Actions

Also available in: Atom PDF