From ad52dbec9a668567367ccab0a056eaf802648dd1 Mon Sep 17 00:00:00 2001 From: Mike Gerwitz Date: Thu, 3 May 2018 14:39:04 -0400 Subject: [PATCH] controller: Only init submit notification if requested * src/server/daemon/controller.js (exports.init): Do not initialize submit notifier if no URL was provided. --- src/server/daemon/controller.js | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/server/daemon/controller.js b/src/server/daemon/controller.js index 6c51f75..17fda41 100644 --- a/src/server/daemon/controller.js +++ b/src/server/daemon/controller.js @@ -146,11 +146,16 @@ exports.init = function( logger, enc_service, conf ) '' ); - rating_service = RatingService - .use( RatingServiceSubmitNotify( createSubmitDapi, dao ) ) - ( - logger, dao, server, exports.rater - ); + // only use the submit notification if a URL was provided + const RatingServiceBase = ( exports.no_results_url ) + ? RatingService.use( + RatingServiceSubmitNotify( createSubmitDapi, dao ) + ) + : RatingService; + + rating_service = RatingServiceBase( + logger, dao, server, exports.rater + ); // TODO: exports.init needs to support callbacks; this will work, but // only because it's unlikely that we'll get a request within