Add feedback route
This commit is contained in:
+24
-1
@@ -15,7 +15,11 @@ exports = module.exports = {
|
||||
|
||||
sendCrashNotification: sendCrashNotification,
|
||||
|
||||
appDied: appDied
|
||||
appDied: appDied,
|
||||
|
||||
FEEDBACK_TYPE_FEEDBACK: 'feedback',
|
||||
FEEDBACK_TYPE_TICKET: 'ticket',
|
||||
sendFeedback: sendFeedback
|
||||
};
|
||||
|
||||
var assert = require('assert'),
|
||||
@@ -277,3 +281,22 @@ function sendCrashNotification(program, context) {
|
||||
|
||||
enqueue(mailOptions);
|
||||
}
|
||||
|
||||
function sendFeedback(user, type, subject, description, callback) {
|
||||
assert.strictEqual(typeof user, 'object');
|
||||
assert.strictEqual(typeof type, 'string');
|
||||
assert.strictEqual(typeof subject, 'string');
|
||||
assert.strictEqual(typeof description, 'string');
|
||||
assert.strictEqual(typeof callback, 'function');
|
||||
|
||||
assert(type === exports.FEEDBACK_TYPE_TICKET || type === exports.FEEDBACK_TYPE_FEEDBACK);
|
||||
|
||||
var mailOptions = {
|
||||
from: config.get('adminEmail'),
|
||||
to: 'johannes@cloudron.io',
|
||||
subject: util.format('[%s] %s - %s', type, config.fqdn(), subject),
|
||||
text: render('feedback.ejs', { fqdn: config.fqdn(), adminEmail: config.get('adminEmail'), type: type, user: user, subject: subject, description: description})
|
||||
};
|
||||
|
||||
enqueue(mailOptions);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user