Add app feedback category
This commit is contained in:
+2
-1
@@ -19,6 +19,7 @@ exports = module.exports = {
|
|||||||
|
|
||||||
FEEDBACK_TYPE_FEEDBACK: 'feedback',
|
FEEDBACK_TYPE_FEEDBACK: 'feedback',
|
||||||
FEEDBACK_TYPE_TICKET: 'ticket',
|
FEEDBACK_TYPE_TICKET: 'ticket',
|
||||||
|
FEEDBACK_TYPE_APP: 'app',
|
||||||
sendFeedback: sendFeedback
|
sendFeedback: sendFeedback
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -288,7 +289,7 @@ function sendFeedback(user, type, subject, description) {
|
|||||||
assert.strictEqual(typeof subject, 'string');
|
assert.strictEqual(typeof subject, 'string');
|
||||||
assert.strictEqual(typeof description, '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 = {
|
var mailOptions = {
|
||||||
from: config.get('adminEmail'),
|
from: config.get('adminEmail'),
|
||||||
|
|||||||
@@ -163,7 +163,7 @@ function setCertificate(req, res, next) {
|
|||||||
function feedback(req, res, next) {
|
function feedback(req, res, next) {
|
||||||
assert.strictEqual(typeof req.user, 'object');
|
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.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'));
|
if (typeof req.body.description !== 'string' || !req.body.description) return next(new HttpError(400, 'description must be string'));
|
||||||
|
|
||||||
|
|||||||
@@ -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) {
|
it('fails without description', function (done) {
|
||||||
request.post(SERVER_URL + '/api/v1/cloudron/feedback')
|
request.post(SERVER_URL + '/api/v1/cloudron/feedback')
|
||||||
.send({ type: 'ticket', subject: 'some subject' })
|
.send({ type: 'ticket', subject: 'some subject' })
|
||||||
|
|||||||
@@ -33,6 +33,7 @@
|
|||||||
<select class="form-control" name="type" style="width: 50%;" ng-model="feedback.type" required>
|
<select class="form-control" name="type" style="width: 50%;" ng-model="feedback.type" required>
|
||||||
<option value="feedback">Enhancement / Idea</option>
|
<option value="feedback">Enhancement / Idea</option>
|
||||||
<option value="ticket">Bug Report</option>
|
<option value="ticket">Bug Report</option>
|
||||||
|
<option value="app">Missing App</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group" ng-class="{ 'has-error': (feedbackForm.subject.$dirty && feedbackForm.subject.$invalid) }">
|
<div class="form-group" ng-class="{ 'has-error': (feedbackForm.subject.$dirty && feedbackForm.subject.$invalid) }">
|
||||||
|
|||||||
Reference in New Issue
Block a user