send channel redemption notifications instantly
Context
- in !384 (merged) we added support for delayed recycling, in which admins get a warning and a 24-hour grace period to "redeem" channels slated for recyling before they are actually recycled
- however, in the current implementation, admins who act on the warning to redeem their channel are not notified until the end of the grace period (potentially as long as 24 hours after they respond to the warning) that the channels will not be recycled
- this seems quite stressful and likely to make users who want to use us very sad and confused
- instead, let's notify them instantly
Value
- as an admin saving my channel from destruction
- i want to know that my channel has been redeemed
- so that i don't worry for 24 hours whether i can still use it and/or not know whether to trust the redemption message when it arrives
Behavior
GIVEN a recycle request has been issued for a channel
- WHEN an admin sends any message to the channel
- THEN the recycle request will be deleted immediately
- AND THEN the admin will get a notification immediately confirming the success of the deletion
Implementation
- add
hasOne
association btw/channel
andrecycleRequest
and include any recycle request tied to a channel in thefindDeep
query issued for every incoming message - on every incoming message try to
detectRedemptionMessage
, and if found, callphoneNumberRegistrar.redeemChannel
, which deletes therecycleRequest
, notifies channel admins and instance maintainers that channel was redeemed - when the
processRecycleRequests
job runs, it no longer needs to consult themessageCounts
table to see what channels were used during the grace period, since if a number was used, it must have already been deleted from therecycleRequests
table. - the "maintainers report" about actions taken during the job will have to change slightly
Edited by aguestuser