fleet/website/api/controllers/view-contact.js
Eric 5219adb7b3
Website: update contact form for applications (#38125)
Changes:
- Updated the contact form to have a third form for job applications.
The form is only shown to users who visit the page with the `#apply`
hash.
- Added `deliver-application-submission` an action that sends
information from job application submissions to a zapier webhook.
- Updated the link to the contact form on the open positions template
page to link to /contact#apply
2026-01-12 11:01:02 -06:00

66 lines
1.4 KiB
JavaScript
Vendored

module.exports = {
friendlyName: 'View contact',
description: 'Display "Contact" page.',
inputs: {
sendMessage: {
type: 'boolean',
description: 'A boolean that determines whether or not to display the talk to us form when the contact page loads.',
defaultsTo: false,
},
},
exits: {
success: {
viewTemplatePath: 'pages/contact'
},
badConfig: {
responseType: 'badConfig'
},
},
fn: async function ({sendMessage}) {
if (!_.isObject(sails.config.builtStaticContent) || !_.isArray(sails.config.builtStaticContent.openPositions)) {
throw {badConfig: 'builtStaticContent.openPositions'};
}
let formToShow = 'talk-to-us';
let userIsLoggedIn = !! this.req.me;
let userHasPremiumSubscription = false;
if(userIsLoggedIn) {
let thisSubscription = await Subscription.findOne({user: this.req.me.id});
if(thisSubscription){
formToShow = 'contact';
userHasPremiumSubscription = true;
}
}
if(sendMessage) {
formToShow = 'contact';
}
let currentOpenPositionsForApplicationDropdown = _.pluck(sails.config.builtStaticContent.openPositions, 'jobTitle');
// Respond with view.
return {
formToShow,
userIsLoggedIn,
userHasPremiumSubscription,
currentOpenPositionsForApplicationDropdown
};
}
};