HomePhabricator
Diffusion Comm 59208c2a222a

[keyserver] `JSON.parse()` stringified `avatar` in `fetchLoggedInUserInfo`

Tags
None
Referenced Files
F442083: 64b3cc.png
Mar 24 2023, 11:33 AM
File Not Attached
Subscribers
None

Description

[keyserver] JSON.parse() stringified avatar in fetchLoggedInUserInfo

Summary:
We want to JSON.parse() the stringified avatar from the database before including in LoggedInUserInfo and returning.

Noticed that on user login avatar was a string instead of an object of type ClientAvatar.

The mysql2 node package conveniently "auto parsed" stringified JSON when providing the result set with MySQL, but unfortunately doesn't for MariaDB (https://github.com/sidorares/node-mysql2/issues/1287)... so we need to JSON.parse(...) ourself.

Test Plan: Logged in and avatar was object of type ClientAvatar as expected:

64b3cc.png (324×426 px, 38 KB)

Reviewers: ashoat, tomek

Reviewed By: ashoat

Differential Revision: https://phab.comm.dev/D7157

Details