From 0a648edcaa11ef0727fad549317d6680e52b9a8a Mon Sep 17 00:00:00 2001 From: Johannes Zellner Date: Thu, 6 Aug 2015 17:34:40 +0200 Subject: [PATCH] Add app feedback category --- src/mailer.js | 3 ++- src/routes/cloudron.js | 2 +- src/routes/test/cloudron-test.js | 11 +++++++++++ webadmin/src/views/support.html | 1 + 4 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/mailer.js b/src/mailer.js index 9b55d7850..a1b9e060a 100644 --- a/src/mailer.js +++ b/src/mailer.js @@ -19,6 +19,7 @@ exports = module.exports = { FEEDBACK_TYPE_FEEDBACK: 'feedback', FEEDBACK_TYPE_TICKET: 'ticket', + FEEDBACK_TYPE_APP: 'app', sendFeedback: sendFeedback }; @@ -288,7 +289,7 @@ function sendFeedback(user, type, subject, description) { assert.strictEqual(typeof subject, 'string'); assert.strictEqual(typeof description, 'string'); - assert(type === exports.FEEDBACK_TYPE_TICKET || type === exports.FEEDBACK_TYPE_FEEDBACK); + assert(type === exports.FEEDBACK_TYPE_TICKET || type === exports.FEEDBACK_TYPE_FEEDBACK || type === exports.FEEDBACK_TYPE_APP); var mailOptions = { from: config.get('adminEmail'), diff --git a/src/routes/cloudron.js b/src/routes/cloudron.js index 62fa8db69..249b326a6 100644 --- a/src/routes/cloudron.js +++ b/src/routes/cloudron.js @@ -163,7 +163,7 @@ function setCertificate(req, res, next) { function feedback(req, res, next) { assert.strictEqual(typeof req.user, 'object'); - if (req.body.type !== mailer.FEEDBACK_TYPE_FEEDBACK && req.body.type !== mailer.FEEDBACK_TYPE_TICKET) return next(new HttpError(400, 'type must be either "ticket" or "feedback"')); + if (req.body.type !== mailer.FEEDBACK_TYPE_FEEDBACK && req.body.type !== mailer.FEEDBACK_TYPE_TICKET && req.body.type !== mailer.FEEDBACK_TYPE_APP) return next(new HttpError(400, 'type must be either "ticket", "feedback" or "app"')); if (typeof req.body.subject !== 'string' || !req.body.subject) return next(new HttpError(400, 'subject must be string')); if (typeof req.body.description !== 'string' || !req.body.description) return next(new HttpError(400, 'description must be string')); diff --git a/src/routes/test/cloudron-test.js b/src/routes/test/cloudron-test.js index 6d75529a9..00653a934 100644 --- a/src/routes/test/cloudron-test.js +++ b/src/routes/test/cloudron-test.js @@ -588,6 +588,17 @@ describe('Cloudron', function () { }); }); + it('succeeds with app type', function (done) { + request.post(SERVER_URL + '/api/v1/cloudron/feedback') + .send({ type: 'app', subject: 'some subject', description: 'some description' }) + .query({ access_token: token }) + .end(function (error, result) { + expect(error).to.not.be.ok(); + expect(result.statusCode).to.equal(201); + done(); + }); + }); + it('fails without description', function (done) { request.post(SERVER_URL + '/api/v1/cloudron/feedback') .send({ type: 'ticket', subject: 'some subject' }) diff --git a/webadmin/src/views/support.html b/webadmin/src/views/support.html index e374df34f..37ce4ed89 100644 --- a/webadmin/src/views/support.html +++ b/webadmin/src/views/support.html @@ -33,6 +33,7 @@