Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pronouns improperly serialized as null when should be empty string #1188

Open
kozabrada123 opened this issue Aug 18, 2024 · 0 comments
Open

Comments

@kozabrada123
Copy link

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

kozabrada123 added a commit to polyphony-chat/chorus that referenced this issue Aug 18, 2024
See spacebarchat/server#1188

A deserialization error was happening with get_user_profile, where pronouns should have been serialized as an empty string, but were instead serialized as null.
kozabrada123 added a commit to polyphony-chat/chorus that referenced this issue Sep 27, 2024
* feat: Add UserProfile and other types

* api: re-do a large part of the users api

* feat: add modify user profile

* feat: delete and disable user endpoints

* feat: modify email and verify email endpoints

* feat!: add discriminator parameter to get_user_by_username

* feat!: add get_user_profile query string schema

* chore: add integration expire behavior

* feat: add get_pomelo_suggestions and get_pomelo_eligibility

* feat: add create_pomelo_migration

* fix: rustdoc lints

* feat: recent_mentions endpoints

Adds GET /users/@me/mentions and DELETE /users/@me/mentions/{message.id}

* feat: add get_user_harvest & create_user_harvest

Also adds /types/entities/harvest.rs, types for Harvest

* feat: user notes endpoints

Adds: get_user_notes, get_user_note, set_user_note

* feat: add #545 and #546

Adds the RECENT_MENTION_DELETE and USER_NOTE_UPDATE gateway events.

The events can be accessed at:
message.recent_mention_delete
&
user.note_update

* feat: add authorize_connection

Also adds: src/types/entities/connection.rs, Connection and PublicConnection,
src/api/users/connections.rs

* feat: add rest* of Connections api

* The only thing not added yet is create_domain_connection, because it uses errors in a funky way

adds:
- create_connection_callback
- create_contact_sync_connection
- get_connections
- refresh_connection
- modify_connection
- delete_connection
- get_connection_access_token
- get_connection_subreddits

+ related schema for all those routes, and some supporting types

* feat: add connected_accounts to UserProfile

* feat: add affinities

* feat: add get_premium_usage endpoint

note: not fully tested; I do not have an account with premium

* cliipy my arch nemesis strikes again

* aa

* feat: add create_domain_connection

* feat: add get_burst_credits

* grumble grumble

* clippy

* fix READY deserialization error on spacebar

* fix a deserialization error on Spacebar

See spacebarchat/server#1188

A deserialization error was happening with get_user_profile, where pronouns should have been serialized as an empty string, but were instead serialized as null.

* skip serializing None query parameters

* add test for get_user_profile

* apparently Sb does not implement users/@me/notes

* add some tests, minor connection updates

- Document that create_domain_connection is unimplemented on Spacebar

- Add Discord connection type

- Change ConnectionType::array() into ConnectionType::vector() - returning a fixed size array is dubious, since it'll likely be expanded. Returning a vector is easier keep up to variable length

- Add ConnectionType::discord_vector() and ConnectionType::spacebar_vector() to return a vector ConnectionTypes available on the respective server backends

- add tests test_modify_user_profile, test_disable_user, test_get_user_note, test_set_user_note, test_get_user_affinities, test_get_guild_affinities, test_get_connections

Note: connections are hard to test, since they require secrets / an external service's account

* minor pre merge changes

- add some extra doc comments

- and into_public() for connection

- remove a todo that is no longer valid
bitfl0wer pushed a commit to polyphony-chat/chorus that referenced this issue Oct 10, 2024
* feat: Add UserProfile and other types

* api: re-do a large part of the users api

* feat: add modify user profile

* feat: delete and disable user endpoints

* feat: modify email and verify email endpoints

* feat!: add discriminator parameter to get_user_by_username

* feat!: add get_user_profile query string schema

* chore: add integration expire behavior

* feat: add get_pomelo_suggestions and get_pomelo_eligibility

* feat: add create_pomelo_migration

* fix: rustdoc lints

* feat: recent_mentions endpoints

Adds GET /users/@me/mentions and DELETE /users/@me/mentions/{message.id}

* feat: add get_user_harvest & create_user_harvest

Also adds /types/entities/harvest.rs, types for Harvest

* feat: user notes endpoints

Adds: get_user_notes, get_user_note, set_user_note

* feat: add #545 and #546

Adds the RECENT_MENTION_DELETE and USER_NOTE_UPDATE gateway events.

The events can be accessed at:
message.recent_mention_delete
&
user.note_update

* feat: add authorize_connection

Also adds: src/types/entities/connection.rs, Connection and PublicConnection,
src/api/users/connections.rs

* feat: add rest* of Connections api

* The only thing not added yet is create_domain_connection, because it uses errors in a funky way

adds:
- create_connection_callback
- create_contact_sync_connection
- get_connections
- refresh_connection
- modify_connection
- delete_connection
- get_connection_access_token
- get_connection_subreddits

+ related schema for all those routes, and some supporting types

* feat: add connected_accounts to UserProfile

* feat: add affinities

* feat: add get_premium_usage endpoint

note: not fully tested; I do not have an account with premium

* cliipy my arch nemesis strikes again

* aa

* feat: add create_domain_connection

* feat: add get_burst_credits

* grumble grumble

* clippy

* fix READY deserialization error on spacebar

* fix a deserialization error on Spacebar

See spacebarchat/server#1188

A deserialization error was happening with get_user_profile, where pronouns should have been serialized as an empty string, but were instead serialized as null.

* skip serializing None query parameters

* add test for get_user_profile

* apparently Sb does not implement users/@me/notes

* add some tests, minor connection updates

- Document that create_domain_connection is unimplemented on Spacebar

- Add Discord connection type

- Change ConnectionType::array() into ConnectionType::vector() - returning a fixed size array is dubious, since it'll likely be expanded. Returning a vector is easier keep up to variable length

- Add ConnectionType::discord_vector() and ConnectionType::spacebar_vector() to return a vector ConnectionTypes available on the respective server backends

- add tests test_modify_user_profile, test_disable_user, test_get_user_note, test_set_user_note, test_get_user_affinities, test_get_guild_affinities, test_get_connections

Note: connections are hard to test, since they require secrets / an external service's account

* minor pre merge changes

- add some extra doc comments

- and into_public() for connection

- remove a todo that is no longer valid
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

No branches or pull requests

1 participant