Skip to content

Remove username from raw_user_meta_data#4587

Draft
jproberson wants to merge 3 commits intomasterfrom
feat/remove-raw_user_meta_data
Draft

Remove username from raw_user_meta_data#4587
jproberson wants to merge 3 commits intomasterfrom
feat/remove-raw_user_meta_data

Conversation

@jproberson
Copy link
Contributor

PR Checklist

  • - Unit and/or e2e tests for the changes that have been added (for bug fixes / features)

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Refactoring (no functional changes)
  • Documentation
  • Other:

What is the new behavior?

Describe the new behaviour
If useful, provide screenshot or capture to highlight main changes

Does this PR introduce a DB Schema Change or Migration?

  • Yes
  • No

Git Issues

Closes #

What happens next?

Thank you for the contribution! We will review it ASAP.

If you need more immediate feedback you can reach out to us on Discord in the Community Platform development channel.

@cypress
Copy link

cypress bot commented Jan 27, 2026

onearmy-community-platform    Run #8471

Run Properties:  status check passed Passed #8471  •  git commit 7f5d6145e4: Merge branch 'master' into feat/remove-raw_user_meta_data
Project onearmy-community-platform
Branch Review feat/remove-raw_user_meta_data
Run status status check passed Passed #8471
Run duration 06m 51s
Commit git commit 7f5d6145e4: Merge branch 'master' into feat/remove-raw_user_meta_data
Committer Mário Nunes
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 2
Tests that did not run due to a developer annotating a test with .skip  Pending 0
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 90
View all changes introduced in this branch ↗︎

@mariojsnunes mariojsnunes marked this pull request as ready for review January 27, 2026 08:03
@mariojsnunes mariojsnunes requested a review from a team as a code owner January 27, 2026 08:03
@mariojsnunes mariojsnunes changed the title trying to remove username from raw_user_meta_data Remove username from raw_user_meta_data Jan 27, 2026
@benfurber
Copy link
Member

@jproberson Can I get a description for this please to understand why this change is being proposed?

@mariojsnunes
Copy link
Contributor

mariojsnunes commented Jan 31, 2026

@benfurber currently we store the username on the auth.users object, it was essential for the firebase migration.
But it causes 2 issues:

  • in case an account exists in multiple tenant, the username must be the same across them
  • harder to change the username

It is also one more thing adding complexity now that we are also looking into creating accounts without profiles (in a first step, for the memberships flow)

This PR is to investigate if we can safely get rid of it, or there is some dependency.

@mariojsnunes
Copy link
Contributor

@jproberson there are still some references to user_metadata

ensureProfile() is how we allow seamless login to each tenant if the user has already registered once.
Need an alternative to that, either:

  • have a UI to prompt the user for a username
  • create the profile without the username - need to see what are the edge cases here
  • get the username from another tenant (via supabase admin rpc)

send-email edge function:

  • fetch the profile via auth_id, or
  • change the email message to not include the username

fetch a research item with updates - it's required due to collaborators being stored as a list of usernames:

  • just make an additional query to the current user profile to get the username, or
  • migrate the collaborators to use ids instead - might be worth doing eventually

search projects - to search by author:

  • just make an additional query to the current user profile to get the username

@mariojsnunes mariojsnunes marked this pull request as draft January 31, 2026 14:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status
Status: 🆕 Backlog

Development

Successfully merging this pull request may close these issues.

3 participants