custom: remove support section

This commit is contained in:
Girish Ramakrishnan
2020-02-04 13:07:26 -08:00
parent c41042635f
commit c9e96cd97a
5 changed files with 8 additions and 21 deletions

View File

@@ -10,7 +10,7 @@ exports = module.exports = {
var appstore = require('../appstore.js'),
assert = require('assert'),
auditSource = require('../auditsource.js'),
custom = require('../custom.js'),
constants = require('../constants.js'),
HttpError = require('connect-lastmile').HttpError,
HttpSuccess = require('connect-lastmile').HttpSuccess,
support = require('../support.js'),
@@ -19,8 +19,6 @@ var appstore = require('../appstore.js'),
function createTicket(req, res, next) {
assert.strictEqual(typeof req.user, 'object');
if (!custom.spec().support.submitTickets) return next(new HttpError(405, 'feature disabled by admin'));
const VALID_TYPES = [ 'feedback', 'ticket', 'app_missing', 'app_error', 'upgrade_request', 'email_error' ];
if (typeof req.body.type !== 'string' || !req.body.type) return next(new HttpError(400, 'type must be string'));
@@ -31,17 +29,15 @@ function createTicket(req, res, next) {
if (req.body.altEmail && typeof req.body.altEmail !== 'string') return next(new HttpError(400, 'altEmail must be string'));
appstore.createTicket(_.extend({ }, req.body, { email: req.user.email, displayName: req.user.displayName }), auditSource.fromRequest(req), function (error) {
if (error) return next(new HttpError(503, `Error contacting cloudron.io: ${error.message}. Please email ${custom.spec().support.email}`));
if (error) return next(new HttpError(503, `Error contacting cloudron.io: ${error.message}. Please email ${constants.SUPPORT_EMAIL}`));
next(new HttpSuccess(201, { message: `An email for sent to ${custom.spec().support.email}. We will get back shortly!` }));
next(new HttpSuccess(201, { message: `An email for sent to ${constants.SUPPORT_EMAIL}. We will get back shortly!` }));
});
}
function enableRemoteSupport(req, res, next) {
assert.strictEqual(typeof req.body, 'object');
if (!custom.spec().support.remoteSupport) return next(new HttpError(405, 'feature disabled by admin'));
if (typeof req.body.enable !== 'boolean') return next(new HttpError(400, 'enabled is required'));
support.enableRemoteSupport(req.body.enable, auditSource.fromRequest(req), function (error) {