Skip to content

Automatic boost approvals front#5882

Ben requested to merge feat/auto-boost-approvals-f5882 into master

Ticket(s) / Related Merge Requests

front#5882

Summary of Changes

Automatic boost approvals.

Testing Considerations

Notes

If any of the last 10 Boosts were rejected or have upheld reports against them, send the new Boost to Admins

This WILL NOT WORK ON LAUNCH as it was agreed with @markryansallee that it is not critical for the Boost V3 launch, and it can wait till we implement #2501 (closed) - at which point it WILL work - by testing this, you are testing that it WILL work IF the status is REPORTED - which that change will make it.

For testing convenience, I have overridden the default config of 10 for sandboxes so it only takes 3 sequential boosts - this is a config value that will not be set on production and defaults to 10. - I did this purely to save you having to repeatedly make 10 boosts.

For all boosts - recommending use of controversial queue as its smaller, and right now the order is oldest first - will save you much scrolling.

Useful Queries
# SELECT YOUR BOOSTS IN TIME DESC ORDER
SELECT guid, owner_guid, admin_guid, status, created_timestamp, updated_timestamp FROM boosts WHERE owner_guid=992568761875697670 ORDER BY created_timestamp DESC LIMIT 10;

# SET STATUS TO REPORTED
UPDATE boosts SET status = 7 WHERE guid = 1468324391950487562;

# SET STATUS TO REJECTED
UPDATE boosts SET status = 7 WHERE guid = 1468324391950487562;

Cash

  1. Boost 3 posts
  2. Reject the first one to reset your count - as you don't know what state it will be in.
  3. Accept the other 2 boosts you made
  4. Boost another post
  5. It should be in the queue - accept it
  6. Boost another - it should be auto-approved - Check in Vitess to confirm the status of it is 2
  7. Manually set the status of your latest boost to 3 - rejected, or reported 7 (could repeat for both)
UPDATE boosts SET status = 3 WHERE guid = 1468318091472539650;
  1. You should have to make 3 approved boosts again before your next boost is auto-accepted.
Onchain
  1. Repeat for an onchain boost (ask if you need tokens or help)
  2. This time your boost will NOT go straight to the queue as it is pending onchain confirmation - the runner that moves it to a confirmed state doesn't work in sandbox, thus you will need to get the boosts GUID from Vitess - exec into the pod and run:
source /vault/secrets/env && php cli.php Blockchain triggerBoostEvent --eventType=resolve --boostGuid=1468320756906594319
  1. Check Vitess and it should be auto-approved (providing you followed instructions closely and your last 3 boosts are approved prior to this), status should now be 2 and it should be in the queue, else it'll be 1 if one of the last boosts was rejected or reported, test both states.
New boosters / less than the limit boosts

Make a new account - send it tokens, you should need to make atleast 3 token boosts before it is approved - you can follow the above flow under cash for this.

Other / Misc

Your approved boosts that WERE NOT FROM AUTO-APPROVAL should have admin_guid's in Vitess.

Deployment Considerations

Modify the boosts table in Vitess

ALTER TABLE boosts ADD admin_guid bigint NULL DEFAULT NULL AFTER status;

If a different value is wanted for the threshold than 10 - configure it via the settings.php boosts['pre_approval_threshold'] - else it will default to 10.

Note there IS a feature flag that is intended to be flipped with the addition of #2501 (closed) - though shouldn't do much harm if you want to turn it on now - it should still work for rejections, which can only really happen when a user has multiple pending boosts.

Regression Scope

Boost creation and approval, all payment methods.

Platform Affected (web, mobile, etc)

Engine, potential to impact all clients.

Developer Testing Completed

Manual, unit.

Screenshots / Screen Recording

Not really possible to screenshot.

Does this impact

  • Localization
  • Dark/light mode
  • Guest mode

Definition of Done Checklist

  • The Acceptance Criteria has been met
  • Code is tested: Testing includes unit/spec, E2E/automated and manual testing
  • Merge requests description has been filled out
Edited by Ben

Merge request reports