HomePhabricator
Diffusion Comm 067316a1a5ef

[Flow202][lib][skip-ci] [26/23] Fix type error in DeviceTokenUpdateRequest

Description

[Flow202][lib][skip-ci] [26/23] Fix type error in DeviceTokenUpdateRequest

Summary:
The Flow upgrade surfaced an issue here. setDeviceToken and setDeviceTokenFanout in device-actions.js currently have type errors due to passing a nullable deviceToken (?string) to DeviceTokenUpdateRequest, which requires a non-nullable string.

Since the input validator already accepted a nullable string, I decided to update the Flow type. I also made some accompanying changes to the endpoint on the keyserver side.

I considered an alternative where setDeviceToken skips calling keyservers if the input is falsey, but I decided against that because I think there is some value to being able to clear a deviceToken from a keyserver.

NOTE: CI will fail on this diff. I considered the possibility of fixing Flow errors BEFORE upgrading Flow, but it wasn't possible... in some cases, the fixes to support the new version of Flow caused errors in the old version. I could have hidden these type errors with $FlowFixMe lines and then later revert those, but that seemed like too much busy work.

Depends on D9749

Test Plan: Flow

Reviewers: inka

Reviewed By: inka

Subscribers: tomek, wyilio

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