DEV: Stop polluting `Class` with deprecated settings methods (PR #10736)

self.class here evaluates to Class and then we’re calling define_method on it which means all classes will have those methods defined in them. For example:

~/discourse(master*) » rails c
Loading development environment (Rails 6.0.3.3)
[1] pry(main)> Integer.methods
=> [:sqrt,
 :yaml_tag,
 :email_domains_blacklist=,
 :email_domains_whitelist=,
 :unicode_username_character_whitelist=,
 :user_website_domains_whitelist=,
 :whitelisted_link_domains=,
 :email_domains_blacklist,
 :email_domains_whitelist,
 :unicode_username_character_whitelist,
...
...

Fix here is to use self.define_singleton_method.

GitHub