fleet/website/api/controllers/try-fleet/view-waitlist.js
Eric 47227d7bd3
Website: add Fleet Sandbox waitlist (#13028)
Changes:
- Added a new config variable:
`sails.config.custom.fleetSandboxWaitlistEnabled`
- Added a new attribute to the website's `user` model:
`inSandboxWaitlist`
- Updated `signup.js` to create user accounts without a Fleet sandbox
instance and `inSandboxWaitlist` set to true if
`sails.config.custom.fleetSandboxWaitlistEnabled` is true.
- Added /try-fleet/waitlist, a page that shows a message to users who
have been added to the Fleet sandbox waitlist.
- renamed`view-sandbox-teleporter-or-redirect-because-expired.js` to
`view-sandbox-teleporter-or-redirect-because-expired-or-waitlist.js` and
updated it to redirect users who are on the Fleet Sandbox waitlist to
/try-fleet/waitlist

Before this PR can be merged, we need to:
- [x] Add `sails.config.custom.fleetSandboxWaitlistEnabled` config
variable in Heroku.
- [x] Add the new attribute to the user table in the website's database
- [x] Update existing `user` records to have the new attribute (set to
false)
..
2023-07-28 18:56:54 -05:00

35 lines
522 B
JavaScript
Vendored

module.exports = {
friendlyName: 'View waitlist',
description: 'Display "Waitlist" page.',
exits: {
success: {
viewTemplatePath: 'pages/try-fleet/waitlist'
},
redirect: {
description: 'This user does not have a valid Fleet Sandbox instance and is being redirected.',
responseType: 'redirect'
},
},
fn: async function () {
if(!this.req.me.inSandboxWaitlist){
throw {redirect: '/try-fleet/sandbox' };
}
// Respond with view.
return {};
}
};