Unable to reuse old username when account "permanently" deleted

Summary
Permanently deleted a user account, went to rename another account to same username, account shows as “deactivated” in the UI.

Steps to reproduce

  1. Ensure ServiceSettings.EnableAPIUserDeletion is set to true in server configuration.
  2. Have test and test1 accounts, both active.
  3. Delete account named test using API with parameter permanent=true
  4. Rename account named test1 to test using API
  5. Attempt to direct-message user in UI.

Expected behavior
If a user account has been permanently deleted, its username should be able to be used again, especially since the internal ID for the user account is 26 random alphanumeric characters.

Observed behavior
Mattermost_2023-04-03_12-27-38-1

Oh, and according to these two forum posts:

… “permanent” deletion removes all of that user’s data from the database.

Hi @datorr2 ,

this is actually “just” a caching issue of the WebApp. After you deleted the user, it will still show up in the sidebar and if you had a DM channel open with it, you will see the DM channel being archived (since the user is deactivated) and you will still be able to find the user in the search, but if you CTRL/Cmd-shift-r(eload) the page, you will see that the username is free again, at least during my tries to reproduce that.

Does refreshing the app work for you, too?

*facepalm* Yes it does. I can’t believe the solution was so simple.

Thank you much, @agriesser !

Awesome, thanks for confirming :slight_smile: Good to know that it’s just a user interface issue and nothing in the database.