Files
fleet/website/api/controllers/view-software-management.js
Eric 8ed163129a Website: update testimonial order (#46971)
Closes: https://github.com/fleetdm/fleet/issues/46872

Changes:
- Updated the `productCategories` value of the testimonial from Adam
Pippert to show it on the /software-management page.
- Updated the order of testimonials on the homepage,
/software-management, /device-management, and /linux-management
2026-06-05 17:11:28 -05:00

70 lines
2.1 KiB
JavaScript
Vendored

module.exports = {
friendlyName: 'View software-management',
description: 'Display "Software management" page.',
exits: {
success: {
viewTemplatePath: 'pages/software-management'
},
badConfig: { responseType: 'badConfig' },
},
fn: async function () {
if (!_.isObject(sails.config.builtStaticContent) || !_.isArray(sails.config.builtStaticContent.testimonials)) {
throw {badConfig: 'builtStaticContent.testimonials'};
}
// Get testimonials for the <scrolalble-tweets> component.
let testimonialsForScrollableTweets = _.clone(sails.config.builtStaticContent.testimonials);
// Only filter and sort testimonials when static content has been built.
// If the build-static-content script was not run, we'll show a placeholder testimonial that is added by the custom hook.
if (sails.config.builtStaticContent.compiledPagePartialsAppPath) {
// Specify an order for the testimonials on this page using the last names of quote authors
let testimonialOrderForThisPage = [
'Luis Madrigal',
'Arsenio Figueroa',
'Bart Reardon',
'Andre Shields',
'Wes Whetstone',
'Nico Waisman',
'Chandra Majumdar',
'Kenny Botelho',
'Erik Gomez',
'Eric Tan',
'Adam Pippert',
'Justin LaBo',
'Brian LaShomb',
];
// Filter the testimonials by product category
testimonialsForScrollableTweets = _.filter(testimonialsForScrollableTweets, (testimonial)=>{
return _.contains(testimonial.productCategories, 'Software management') && _.contains(testimonialOrderForThisPage, testimonial.quoteAuthorName);
});
testimonialsForScrollableTweets.sort((a, b)=>{
if(testimonialOrderForThisPage.indexOf(a.quoteAuthorName) === -1){
return 1;
} else if(testimonialOrderForThisPage.indexOf(b.quoteAuthorName) === -1) {
return -1;
}
return testimonialOrderForThisPage.indexOf(a.quoteAuthorName) - testimonialOrderForThisPage.indexOf(b.quoteAuthorName);
});
}//fi
// Respond with view.
return {
testimonialsForScrollableTweets,
};
}
};