Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
polonel committed Nov 2, 2017
2 parents 54a9436 + 320d172 commit af1940d
Show file tree
Hide file tree
Showing 19 changed files with 54 additions and 303 deletions.
9 changes: 2 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Built on [Node.JS](http://nodejs.org) and [MongoDB](http://www.mongodb.org).

### Install & Run
1. Clone the repo using: ```git clone http://www.github.com/polonel/trudesk```
2. Install dependencies: ```npm install```
2. Install dependencies: ```npm i yarn -g && yarn```
3. Build the scripts: ```npm run build```
3. Start the server: ```npm start```
4. Navigate to: ```http://localhost:8118```
Expand All @@ -32,12 +32,7 @@ The Trudesk Virtual Appliance can quickly deploy to both Virtual Box as well as
### Documentation
___Docs are still in development___

To view the online documentation: [http://www.trudesk.io/docs](http://www.trudesk.io/docs)

To build the development documentation run ```grunt builddocs```.

The documentation after build is located in:
- ```{repo folder}/apidocs```
To view the online documentation: [http://www.trudesk.io/v1/guide](http://www.trudesk.io/v1/guide)

### Help
if you like what you see here, and want to help support the work being done, you could:
Expand Down
184 changes: 0 additions & 184 deletions package-lock.json

This file was deleted.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"chance": "1.0.3",
"clone": "1.0.2",
"connect-flash": "0.1.1",
"connect-mongo": "1.2.1",
"connect-mongo": "2.0.0",
"cookie": "0.3.1",
"cookie-parser": "1.4.3",
"css-loader": "0.28.1",
Expand Down
12 changes: 9 additions & 3 deletions src/cache/quickStats.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,14 @@ function buildMostRequester(ticketArray, callback) {
});

var r = _.countBy(requesters, function(k) { return k; });
r = _(r).toPairs().sortBy(0).fromPairs().value();
r = _(r).value();

r = _.map(r, function(v, k) {
return { name: k, value: v};
});

r = _.sortBy(r, function(o) { return -o.value; });

return callback(r);
}

Expand All @@ -125,12 +127,14 @@ function buildMostComments(ticketArray, callback) {
return k;
});

c = _(c).toPairs().sortBy(0).fromPairs().value();
c = _(c).value();

c = _.map(c, function(v, k) {
return { name: k, value: v};
});

c = _.sortBy(c, function(o) { return -o.value; });

return callback(c);
}

Expand All @@ -145,12 +149,14 @@ function buildMostAssignee(ticketArray, callback) {

var a = _.countBy(assignees, function(k) { return k; });

a = _(a).toPairs().sortBy(0).fromPairs().value();
a = _(a).value();

a = _.map(a, function(v, k) {
return { name: k, value: v};
});

a = _.sortBy(a, function(o) { return -o.value; });

return callback(a);
}

Expand Down
19 changes: 2 additions & 17 deletions src/cache/tagStats.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,29 +62,14 @@ var init = function(tickets, timespan, callback) {
});
}

_.mixin({
'sortKeysBy': function (obj, comparator) {
var keys = _.sortBy(_.keys(obj), function (key) {
return comparator ? comparator(obj[key], key) : key;
});


return _.fromPairs(keys, _.map(keys, function (key) {
return obj[key];
}));
}
});

tags = _.reduce(t, function(counts, key) {
counts[key]++;
return counts;
}, _.fromPairs(_.map(_.uniq(t), function(key) {
}, _.fromPairs(_.map(t, function(key) {
return [key, 0];
})));

tags = _.sortKeysBy(tags, function(value) {
return -value;
});
tags = _.fromPairs(_.sortBy(_.toPairs(tags), function(a){ return a[1]}).reverse());

return done();
}
Expand Down
2 changes: 1 addition & 1 deletion src/controllers/api/v1/tickets.js
Original file line number Diff line number Diff line change
Expand Up @@ -1580,7 +1580,7 @@ api_tickets.getOverdue = function(req, res) {
settingSchema.getSettingByName('showOverdueTickets:enable', function(err, setting) {
if (err) return res.status(400).json({success: false, error: err.message});

if (setting != null && setting.value === false) {
if (setting !== null && setting.value === false) {
return res.json({success: true, error: 'Show Overdue currently disabled.'});
} else {
var ticketSchema = require('../../../models/ticket');
Expand Down
8 changes: 4 additions & 4 deletions src/controllers/api/v1/users.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ api_users.getWithLimit = function(req, res) {

user.groups = _.map(groups, 'name');

result.push(user);
result.push(StripUserFields(user));
c();
}, function(err) {
if (err) return callback(err);
Expand Down Expand Up @@ -424,7 +424,7 @@ api_users.update = function(req, res) {
*/
api_users.updatePreferences = function(req, res) {
var username = req.params.username;
if(username == undefined || username == 'undefined')
if(typeof(username) === "undefined")
return res.status(400).json({success: false, error: 'Invalid Request'});

var data = req.body;
Expand Down Expand Up @@ -594,7 +594,6 @@ api_users.enableUser = function(req, res) {
* @apiSuccess {string} email Email Address of the User
* @apiSuccess {string} role Assigned Permission Role of the user
* @apiSuccess {string} title Title of the User
* @apiSuccess {string} accessToken Access Token for the user to access the API
* @apiSuccess {string} image Image filename for the user's profile picture
* @apiSuccess {array} iOSDeviceTokens iOS Device Tokens for push notifications
*
Expand Down Expand Up @@ -912,7 +911,7 @@ api_users.uploadProfilePic = function(req, res) {
object.username = req.params.username;

busboy.on('file', function(fieldname, file, filename, encoding, mimetype) {
if (mimetype.indexOf('image/') == -1) {
if (mimetype.indexOf('image/') === -1) {
error = {
status: 400,
message: 'Invalid file type'
Expand Down Expand Up @@ -975,6 +974,7 @@ function StripUserFields(user) {
user.accessToken = undefined;
user.__v = undefined;
//user.role = undefined;
user.tOTPKey = undefined;
user.iOSDeviceTokens = undefined;

return user;
Expand Down
9 changes: 6 additions & 3 deletions src/controllers/tickets.js
Original file line number Diff line number Diff line change
Expand Up @@ -558,9 +558,12 @@ ticketsController.uploadAttachment = function(req, res) {
busboy.on('file', function(fieldname, file, filename, encoding, mimetype) {
winston.debug(mimetype);

if (mimetype.indexOf('image/') == -1 &&
mimetype.indexOf('text/') == -1 &&
mimetype.indexOf('application/x-zip-compressed') == -1) {
if (mimetype.indexOf('image/') === -1 &&
mimetype.indexOf('text/') === -1 &&
mimetype.indexOf('audio/mpeg') === -1 &&
mimetype.indexOf('audio/mp3') === -1 &&
mimetype.indexOf('audio/wav') === -1 &&
mimetype.indexOf('application/x-zip-compressed') === -1) {
error = {
status: 500,
message: 'Invalid File Type'
Expand Down
2 changes: 1 addition & 1 deletion src/helpers/plugins/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ pluginHelpers.checkPermissions = function(userRole, permissions) {
var permissionArray = permissions.split(' ');
var result = false;
for (var i = 0; i < permissionArray.length; i++) {
if (userRole.toString().toLowerCase() == permissionArray[i].toString().toLowerCase())
if (userRole.toString().toLowerCase() === permissionArray[i].toString().toLowerCase())
result = true;
}

Expand Down
24 changes: 0 additions & 24 deletions src/helpers/underscore/index.js

This file was deleted.

Loading

0 comments on commit af1940d

Please sign in to comment.