Tidy up things a bit

This commit is contained in:
Joakim Stai 2015-01-26 22:56:10 +01:00
parent 24577862a5
commit 5331831ed3
2 changed files with 16 additions and 13 deletions

View File

@ -2,16 +2,19 @@ var Slackus = require('./lib/slackus.js'),
config = require('./config.js');
// Check if the required configuration values have been set.
var required = ['slack.webhook', 'disqus.forums',
var required = [
'slack.webhook',
'disqus.forums',
'disqus.authentication.api_secret',
'disqus.authentication.api_key',
'disqus.authentication.access_token'].filter(function(config, path) {
var i, len;
for (i = 0, path = path.split('.'), len = path.length; i < len; i++) {
config = config[path[i]];
}
return !config;
}.bind(this, config));
'disqus.authentication.access_token'
].filter(function(config, path) {
var i, len;
for (i = 0, path = path.split('.'), len = path.length; i < len; i++) {
config = config[path[i]];
}
return !config;
}.bind(this, config));
// Exit if missing required configuration.
if (required.length) {

View File

@ -49,7 +49,7 @@ Slackus.prototype.checkComments = function(forum, data) {
}
// The creation time of the most recent comment.
var latestCommentTime;
var lastCommentTime;
var i;
for (i = 0; i < response.length; i++) {
@ -60,14 +60,14 @@ Slackus.prototype.checkComments = function(forum, data) {
this.sendMessage(message, forum);
if (!latestCommentTime) {
latestCommentTime = commentTime;
if (!lastCommentTime) {
lastCommentTime = commentTime;
}
}
}
if (latestCommentTime) {
this.lastChecked = latestCommentTime;
if (lastCommentTime) {
this.lastChecked = lastCommentTime;
}
};