Page MenuHomePhabricator

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

Authored by atul on Mar 23 2023, 10:50 AM.
Tags
None
Referenced Files
F1791053: D7157.id.diff
Sun, May 19, 9:56 AM
Unknown Object (File)
Fri, May 17, 10:30 PM
Unknown Object (File)
Tue, May 14, 10:47 PM
Unknown Object (File)
Wed, May 8, 5:12 AM
Unknown Object (File)
Mon, May 6, 10:04 PM
Unknown Object (File)
Mar 28 2024, 3:03 AM
Unknown Object (File)
Mar 28 2024, 3:03 AM
Unknown Object (File)
Mar 28 2024, 3:03 AM
Subscribers
None

Details

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)

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable