Skip to content

Allow users to change name on profile page#3357

Open
rhysyngsun wants to merge 7 commits into
mainfrom
nl/change-name
Open

Allow users to change name on profile page#3357
rhysyngsun wants to merge 7 commits into
mainfrom
nl/change-name

Conversation

@rhysyngsun
Copy link
Copy Markdown
Contributor

@rhysyngsun rhysyngsun commented May 19, 2026

What are the relevant tickets?

Fixes https://github.com/mitodl/hq/issues/11260

Description (What does it do?)

This makes the name input on the profile edit page functional. It does so by optimistically updating the value in the DB and then writing the new value upstream to Keycloak. As part of this, I've also modified the apisix middleware to not update existing users because this ends up overwriting on the new value immediately because apisix has a stale view of the userinfo. This means we depend on SCIM for updates, so if you don't have that configured locally you won't see updates happen for learn anymore.

Some changes related to making this happen:

  • I had to rewrite WritableSerializerMethodField so that the implementation is more correct. The reason for this is because Field.__init__() dynamically sets some properties based on read_only=True, which SerializerMethodField is hardcoded with. So I use Python's method resolution order (MRO) to strip that out between SerializerMethodField.__init__() and Field.__init__(). This results in more technically correct internal state of the field. However, it also had the side effect of making a bunch of fields required (aforemetioned dynamic behavior). To avoid this, I set default values in some places where it made sense, but left some as required (specifically the widget config) because that makes sense.
  • I also removed User create/destroy/list because these don't make sense in Learn (carryover from open-discussions).

How can this be tested?

Go to the profile page and update your name. It should save successfully and your name on the dashboard and header should update. If you perform a full page update you should still see the new user value. You should also check keycloak to verify the new value is there as well.

The SCIM integration already works so no need to test that.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 19, 2026

OpenAPI Changes

35 changes: 19 error, 0 warning, 16 info

View full changelog

Unexpected changes? Ensure your branch is up-to-date with main (consider rebasing).

@rhysyngsun rhysyngsun changed the title Nl/change name Allow users to change name on profile page May 19, 2026
@rhysyngsun rhysyngsun force-pushed the nl/change-name branch 3 times, most recently from 1eff7d2 to 3526158 Compare May 20, 2026 14:47
@rhysyngsun rhysyngsun marked this pull request as ready for review May 20, 2026 18:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant