I just changed the username of a person xxx on their demand. they wanted to take an inactive username yyy. so first I changed the inactive username yyy to somthing else like yyy1 and then changed that person username from xxx to yyy.
at this point, first, the user couldnt post anything and I saw the following error in the logs:
btw idk why im getting error on this user (username_lower)=(mina) at all. I have never done any change to it and seems it is an inactive user. However I see a wierd behaviour on their profile too. If I open their notification page, I get a 404 error.
Ok, I ran through the steps. If I did anything different from what you did, let me know.
There are two users:
xxx (active account)
yyy (inactive account)
Change yyy to yyy1
Change xxx to yyy
( worked for me)
Try posting using the new yyy account
( worked for me)
Change yyy back to xxx
( worked for me, no loss of user history)
I didn’t have any issues through the whole process. One thing to note is that after you change a user’s username from the user admin page, you will need to refresh the page before the “Show public profile” button will navigate to the correct user.
Can you check your /admin/logs/staff_action_logs to see if all of the logged username changes make sense? Clicking on the avatars of the listed usernames should take you to their current and correct user page.
Yes clicking on the avatar takes me to their page. however, it sems to me that their page is kind of inactive. for example I cant display their email or impersonate their account:
according to what I see in this report, first I changed fatemeh to fatemeh12 . then changed fatemeh_baghdadi to fatemeh . after a while, the user told me that they cant post anything. so I thought maybe there was somthing wrong in the process of changing username and tried to change the username to somthing that hasnt been used so far. so I changed fatemeh (previously fatemeh_baghdadi) to fatemeh74. then I saw that their history got cleared totaly and I got nervous. So I tried to change back the username to what was in the begining from fatemeh74 to fatemeh_baghdadi . and again from fatemeh_baghdadi to fatemeh_baghdadi5 but nothing get better. now I have two diffrent user fatemeh74 and fatemeh_baghdadi5 which theoritically should be one person but actually they are 2 person, one seems to be not working correctly.
I’m trying my best to follow along here. It sounds like a very odd situation!
Can you clarify what you mean when you say that their history was totally cleared? Should fatemeh_baghdadi5 have various topics and replies listed under the activity section of their profile?
If that is the case, are those posts now associated with the fatemeh74 account? They should exist somewhere on the site and be associated with a specific user. From an anonymous user perspective, I’m not able to find a user with the username fatemeh74 on your site.
There is a background job called EnsureDbConsistency that runs every 12 hours. It might be interesting to either trigger it manually from sidekiq, or wait and see if everything gets fixed automatically in the next 12 hours.
If you do end up having two accounts that should be one, you should be able to merge them. I would definitely take a backup before attempting that, however.
It’s really hard to understand what’s going on without having direct access to everything, but hopefully we can get it figured out!
at the moment that I changed the username, I went to their profile and saw no posts, etc. but it got fixed after a while. however now fatemeh74 which actually seems to be the correct person, is kind of inactive. I mean as you see, we cant see their profile page, while their post and other things are present. like this:
They are not actually one, I checked their email and their id and theyre completely diffrent. However according to the steps I changed the usernames, they should be the same and actually I shouldnt have two users here.
Usernames are effectively case-insensitive, so you shouldn’t be able to have two users with the same username. However:
You can see what appears to be two distinct usernames returned when searching for fatemeh12. This shouldn’t have been able to happen (I’m not able to reproduce it). Both go to the same profile it seems.
I’m at a loss on where to go from here. If someone doesn’t chime in by around this time tomorrow, I’ll see if I can track someone down with some fresh ideas. If you find any additional information that you think is relevant in the mean time, please post it.
What I underestand by now is this: At the very first step, I tried to change fatemeh to fatemeh12 in order to make that username free. However, there was already a Fatemeh12 username, so in fact I shouldnt be allowed to change fatemeh to fatemeh12. However it weirdly let me do that and somehow database screwed from this point.
@tshenry did you find anything? right now the user fatemeh74 which was gone, is somehow healed. idk how exactly though. I want to make sure this wont happen in future, so I need to know why I have same usernames with uppercase/lowercase difference. and why discourse wont prevent such thing. my discourse is updated already .
Hey there That is great to hear. I was hoping that a background job might come to rescue after some time passed. It sounds like that might have been what happened.
I have not had a chance to look into this further. We are really limited on what we can do to help since we do not have database access to your site and would only be able to dig in like that for our hosted customers.
This is the first occurrence that we have heard of this happening and I’m not able to reproduce the behavior. I suspect this is an edge case with your instance. We will certainly keep an eye out for any similar occurrences in the future. If you want to be extra careful, I would just do a double check that there isn’t anyone with the same username before making a username change.
We are also experiencing this same issue for a long time now - of course there’s no way to reproduce how the database got in this state but every so often we end up with users either self-renaming to duplicate names during the rename grace period, but this also applies to admin renames.
We don’t use unicode usernames, and this is pretty… problematic at times as this breaks the Patreon plugin’s sync job at times which we heavily rely on for external policy services.