Robin,
I’m currently preparing a PR for the Discord OAuth Plugin mainly to store more Discord user information in Discourse. I’m trying to use your ReviewableUser model in order to retain functionality that implements automated approval.
Because the implementation currently enters a review for new users asynchronously I need to check if such a review has been created and clear it.
Unfortunately I’m getting a very strange Ruby error and wondered if you have come across it.
Code is:
def after_create_account(user, auth)
super
data = auth[:extra_data]
if !user.approved && data[:auto_approve]
user.approved = true
user.approved_by_id = Discourse.system_user.id
if reviewable_user = ReviewableUser.find_by(target: user)
reviewable_user.set_approved_fields!(user, Discourse.system_user)
end
end
end
As soon as it fires ReviewUser.find_by I get an exception:
*** NameError Exception: wrong constant name #<Class:0x000056134e417870>::DiscordAuthenticator
Whilst I thought I was making good strides in my Ruby, i’m not clear why it’s doing this?
Is it a path issue? I’ve tried a bunch of requires but that snowballs.
It’s very like similar patterns elsewhere in the core code. Any thoughts are much appreciated!
Repo here if you need: https://github.com/merefield/discourse-plugin-discord-auth/blob/master/plugin.rb