register_editable_user_custom_field wrong number of arguments


Discourse Version: d914ea83663bbd5392b01de25afc8f5ccfb138d2

Plugin Commit: 2a686be1babb684901b5debfd7759fecf65b8338

Steps to Reproduce

Install the plugin.

This started happening since upgrading to Ruby 3.1.3.


ArgumentError: wrong number of arguments (given 0, expected 1)
/var/www/discourse/lib/plugin/instance.rb:170:in `register_editable_user_custom_field'
/var/www/discourse/plugins/discourse-locations/plugin.rb:95:in `block in activate!'
/var/www/discourse/lib/plugin/instance.rb:479:in `block in notify_after_initialize'

This plugin and the multilingual plugin have a pattern that no other plugin has and which is currently breaking on latest tests-passed.

On multilingual it’s line 90 of plugin.rb (second line below)

register_editable_user_custom_field :content_languages
register_editable_user_custom_field content_languages: []

and on locations it’s similar

register_editable_user_custom_field :geo_location if defined? register_editable_user_custom_field
register_editable_user_custom_field geo_location: {} if defined? register_editable_user_custom_field

what is the use of that second line @angus @merefield? Can it safely be removed?

This is now resolved (for locations).

Thanks @merefield