Some fixes so that the subscription forms work with the new mailer

This commit is contained in:
Tomas Bures 2018-05-20 20:27:35 +02:00
parent 446d75ce71
commit 1f5566ca9b
5 changed files with 22 additions and 9 deletions

View file

@ -65,11 +65,13 @@ hbs.registerPartials(__dirname + '/views/subscription/partials/');
* and the message is never displayed
*/
hbs.registerHelper('flash_messages', function () { // eslint-disable-line prefer-arrow-callback
console.log(this.flash);
if (typeof this.flash !== 'function') { // eslint-disable-line no-invalid-this
return '';
}
let messages = this.flash(); // eslint-disable-line no-invalid-this
console.log(messages);
let response = [];
// group messages by type
@ -185,9 +187,15 @@ function createApp(trusted) {
useWith404Fallback('/mailtrain', express.static(path.join(__dirname, 'client', 'dist')));
useWith404Fallback('/locales', express.static(path.join(__dirname, 'client', 'locales')));
/* FIXME - can we remove this???
// make sure flash messages are available
// Make sure flash messages are available
// Currently, flash messages are used only from routes/subscription.js
app.use((req, res, next) => {
res.locals.flash = req.flash.bind(req);
next();
});
/* FIXME - can we remove this???
app.use((req, res, next) => {
res.locals.flash = req.flash.bind(req);
res.locals.user = req.user;