spacebarchat / spacebarchat/server

Pronouns improperly serialized as null when should be empty string

Open
#1,188 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
2.2k
Forks
323
Avg merge
14h 48m
Merged PRs (30d)
4

Description

Describe the bug
When using the endpoint GET /users/{id}/profile, the pronouns field in user_profile is sent as null on Spacebar, but as an empty string ("") on Discord (if the user has no pronouns set)

To Reproduce
Send a request to GET /users/{id}/profile on Discord.
See the response data:

{
...
"user_profile": {
    "bio": "Level 6 warlock charisma caster, professional gnome adventurer, you can find at your local tavern killing rats in the basement",
    "accent_color": 16777215,
    "pronouns": ""
},
...
}

Send a request to GET /users/{id}/profile on Spacebar.
See the response data:

{
...
"user_profile": {
    "bio": "",
    "accent_color": null,
    "banner": null,
    "pronouns": null,
    "theme_colors": null
},
...
}

Expected behavior
Instead of serializing as "pronouns": null, it should probably be "pronouns": "", to mirror Discord

Env and Software info
Tested on the staging server, old.server.spacebar.chat

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at GET /users/{id}/profile and trace how user_profile.pronouns is serialized, comparing the current Spacebar response with the Discord example. Done when users without pronouns receive an empty string instead of null, with coverage for this response behavior if the endpoint has existing tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.