mirror of
https://github.com/fleetdm/fleet
synced 2026-05-22 08:28:52 +00:00
Closes: #18530 Changes: - Added a collapsable sitewide CTA to bring users who have not completed the get started questionnaire back to the /start page. - Added a new action (`account/updateStartCtaVisibility`) to set a timestamp of when the CTA will be visible (not collapsed) in a user's session when they close the CTA --------- Co-authored-by: Mike Thomas <[email protected]>
37 lines
747 B
JavaScript
Vendored
37 lines
747 B
JavaScript
Vendored
module.exports = {
|
|
|
|
|
|
friendlyName: 'Update start CTA visibility',
|
|
|
|
|
|
description: 'Sets a timestamp to determine when we should show the user the start CTA after they have dismissed it.',
|
|
|
|
|
|
inputs: {
|
|
|
|
},
|
|
|
|
|
|
exits: {
|
|
|
|
},
|
|
|
|
|
|
fn: async function () {
|
|
if(!this.req.session){
|
|
throw new Error('Consistency violation. When a user sent a request to the update start CTA visibility endpoint, a session is missing.');
|
|
}
|
|
if(this.req.session.expandCtaAt) {
|
|
// Expand the CTA.
|
|
this.req.session.expandCtaAt = 0;
|
|
} else {
|
|
// collapse CTA for 24 hours.
|
|
let nowAt = Date.now();
|
|
let tomorrowAt = nowAt + (24 * 60 * 60 * 1000);
|
|
this.req.session.expandCtaAt = tomorrowAt;
|
|
}
|
|
return;
|
|
}
|
|
|
|
|
|
};
|