Skip to content

Fix: rename 'username' to 'name' in account creation endpoints (api side, web#955)#511

Open
mircealungu wants to merge 1 commit intomasterfrom
auto-fix/issue-955-api
Open

Fix: rename 'username' to 'name' in account creation endpoints (api side, web#955)#511
mircealungu wants to merge 1 commit intomasterfrom
auto-fix/issue-955-api

Conversation

@mircealungu
Copy link
Copy Markdown
Member

Summary

Fixes the API-side of the naming inconsistency described in zeeguu/web#955.

The add_user and add_basic_user endpoints were reading the user's display name from the username form field, and passing it through create_account() / create_basic_account() as a parameter also named username. This was inconsistent with:

  • User.__init__ and User.name (the model uses name)
  • The name database column
  • The user_settings endpoint which reads data.get("name", None)
  • The get_user_details API response which returns name

Changes:

  • accounts.py: request.form.get("username")request.form.get("name") in both add_user and add_basic_user
  • user_account_creation.py: parameter usernamename in create_account() and create_basic_account()
  • test_account_creation.py: update form data keys from username= to name=

Must be merged together with the matching web-side PR: zeeguu/web#996

Commits

  1. Fix commit (5263cf4): Rename the form parameter and internal variable from username to name throughout the account creation flow, including tests.

The HTTP form parameter for the user's display name was inconsistently
called 'username' in the add_user / add_basic_user endpoints and the
create_account / create_basic_account functions, while the User model,
DB column, settings endpoint, and API response all use 'name'.

Rename the form parameter and internal variable throughout:
- accounts.py: request.form.get("username") → request.form.get("name")
- user_account_creation.py: parameter 'username' → 'name' in both
  create_account() and create_basic_account()
- test_account_creation.py: update form data keys to match

Must be applied together with the matching web/accounts.js change.

Closes zeeguu/web#955
@github-actions
Copy link
Copy Markdown

ArchLens - No architecturally relevant changes to the existing views

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.

2 participants