Page MenuHomePhabricator

[lib/native/web] refactor recordNotifPermissionAlertActionType to recordAlertActionType
ClosedPublic

Authored by ginsu on Tue, Apr 9, 10:25 AM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Apr 17, 1:18 PM
Unknown Object (File)
Wed, Apr 17, 8:56 AM
Unknown Object (File)
Mon, Apr 15, 11:37 PM
Unknown Object (File)
Mon, Apr 15, 6:11 PM
Unknown Object (File)
Mon, Apr 15, 3:52 PM
Unknown Object (File)
Mon, Apr 15, 10:46 AM
Unknown Object (File)
Mon, Apr 15, 9:18 AM
Unknown Object (File)
Sat, Apr 13, 7:15 PM
Subscribers

Details

Summary

This diff refactors recordNotifPermissionAlertActionType and into a more generic recordAlertActionType. I also updated the payload for this action to include the alert type so that the alert info reducer knows which alert info state in the alert store should be updated

Please note this diff + subsequent diffs won't be landed until the migration diff which will be introduced here shortly

Linear task: https://linear.app/comm/issue/ENG-7625/introduce-recordconnectfarcasteralertactiontype

Depends on D11599

Test Plan

flow + confirmed that the existing notif permission alert mechanism still works as expected

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

ginsu requested review of this revision.Tue, Apr 9, 10:44 AM

found a bug

ginsu requested review of this revision.Tue, Apr 9, 12:06 PM
ginsu edited the summary of this revision. (Show Details)
ginsu edited the test plan for this revision. (Show Details)
ginsu added reviewers: atul, inka.

actually jk, I confused myself there is no bug with this diff

atul added inline comments.
lib/reducers/alert-reducer.js
15 ↗(On Diff #38955)

Is existing state.alertInfos[action.payload.alertType].totalAlerts expected to always be a number? Do we need to handle null/undefined case?

Looks like number is required for RecordAlertActionPayload, but is it possible for an RecordAlertActionPayload to be missing for given alertType?

21 ↗(On Diff #38955)

Feel free to keep newline if intentional

This revision is now accepted and ready to land.Wed, Apr 10, 10:39 AM
lib/reducers/alert-reducer.js
15 ↗(On Diff #38955)

Spoke to @atul about this IRL but based on how RecordAlertActionPayload is typed, the dev must pass in a valid alertType into the payload. If they pass in something not valid flow will throw an error which should address @atul's concerns

Screenshot 2024-04-10 at 3.28.26 PM.png (836×2 px, 213 KB)