Why this user keeps showing in review tab without accepted button?

AI-generated summary

Phuong_SuSu reported an issue where a user account appears in the review tab with no “approve” button, only a “delete account” option, despite being active. The system incorrectly shows the user was approved by “noone,” and the review notification count remains stuck at (1). eviltrout initially suggested toggling the must_approve_users setting, but Phuong_SuSu confirmed this had no effect. eviltrout then diagnosed the issue: the user’s associated reviewable record was never marked as approved. To fix it, they advised retrieving the reviewable ID from the URL (e.g., /review/1234) and running either Reviewable.find(1234).update_column(:status, 1) in the Rails console or the SQL equivalent UPDATE reviewables SET status = 1 WHERE id = 1234. Phuong_SuSu confirmed the fix worked using the Rails console and asked how to run the SQL command directly. eviltrout replied that if Discourse is installed via Docker, one can use rails dbconsole inside the container to access the database directly. The issue was resolved successfully, and Phuong_SuSu expressed gratitude.

Hello,

A user may register while I switching approval options in admin settings.
Now I get a funny situation :slight_smile:

Her account was actived, the system shows that she was also approved by (noone)
then her account keeps showing in the review tab with only… a delete account button.
And in the review notifications menu, I always got (1) there…

What should I do ???

Could you temporarily enable must_approve_users, approve them, then disable it again?

I enable or disable the that mode many times, the result is the same, no “approve” button could be found (although other users are normal, except this user)
I think I need to update in the database somewhere, do you have any suggestion?

Ah I think I understand the problem now. The user was created, but the associated reviewable record was not marked as approved.

To fix this you will need the id of the reviewable item. You can get this by clicking on the date on the reviewable item, and the url will look like /review/1234 - 1234 is the number you want.

Then you can open a rails console:

rails c

And type this:

Reviewable.find(1234).update_column(:status, 1)

If you find accessing the database easier, the query would be this:

UPDATE reviewables SET status = 1 WHERE id = 1234

You are the hero!
I opened a rails console and enter the first command, the problem is gone :smiley:

A quick question, how to accessing database like the second command?
I used the “Data Explorer Plugin” but it seemed just query the database, cannot update it.

I’m new to Discourse ^^!

It depends how you’ve installed discourse, but you can do rails dbconsole in the docker container and it should connect you to the database.