Approving a new user with ruby console - 20200613.042854

This was working around March and is now failing for some reason.

ReviewableUser.find_by(target:user).perform(csmu, :approve_user)
NoMethodError: undefined method `perform' for nil:NilClass

user and csmu are valid objects.
We’re on version 2.4.0.beta11 and we’re planning to move to the latest beta next week.

Any ideas?

1 Like

Hi @Keith,

My suggestion is to setup the latest version of Discourse on a staging server and restore the DB of that staging server Discourse instance with a full backup (including uploads) from your current production version.

Then, you can test that staging instance first in a safe staging environment and see how it works.

That’s what we do.

Hope this helps.

2 Likes

I think it resolved to not activating the user.

The following worked

admin_user = User.find_by_username('{{admin_username}}')

user = User.create
user.name = '{{name}}'
user.username = '{{username}}'
user.email = '{{email}}'
user.password = '{{password}}'
user.activate
user.admin = true
user.moderator = true
user.save!

ReviewableUser.find_by(target:user).perform(admin_user, :approve_user)