From 7ea675159e0fa2e1c3af7a913cd2480e0a039062 Mon Sep 17 00:00:00 2001 From: yanas Date: Mon, 16 Nov 2015 18:06:28 -0600 Subject: [PATCH] Disables feedback functionality if callstats isn't available. --- css/main.css | 1 + modules/UI/Feedback.js | 30 +++++++++++++++++++++++++++--- modules/UI/UI.js | 5 +---- modules/UI/toolbars/Toolbar.js | 26 +++++++++++++++++++++----- 4 files changed, 50 insertions(+), 12 deletions(-) diff --git a/css/main.css b/css/main.css index e4855d8c9..5a937025f 100644 --- a/css/main.css +++ b/css/main.css @@ -248,6 +248,7 @@ form { } div.feedbackButton { + display: none; position: absolute; background-color: rgba(0,0,0,.50); border-radius: 50%; diff --git a/modules/UI/Feedback.js b/modules/UI/Feedback.js index 670bb38ea..baf53447c 100644 --- a/modules/UI/Feedback.js +++ b/modules/UI/Feedback.js @@ -1,4 +1,4 @@ -/* global $, interfaceConfig */ +/* global $, config, interfaceConfig */ /* * Created by Yana Stamcheva on 2/10/15. @@ -73,6 +73,30 @@ var Feedback = { * The feedback score. -1 indicates no score has been given for now. */ feedbackScore: -1, + /** + * Initialise the Feedback functionality. + */ + init: function () { + // CallStats is the way we send feedback, so we don't have to initialise + // if callstats isn't enabled. + if (!config.callStatsID || !config.callStatsSecret) + return; + + $("div.feedbackButton").css("display", "block"); + $("#feedbackButton").click(function (event) { + Feedback.openFeedbackWindow(); + }); + }, + /** + * Indicates if the feedback functionality is enabled. + * + * @return true if the feedback functionality is enabled, false otherwise. + */ + isEnabled: function() { + var isCallStatsEnabled = (config.callStatsID && config.callStatsSecret); + + return isCallStatsEnabled; + }, /** * Opens the feedback window. */ @@ -120,7 +144,7 @@ var Feedback = { var states = { overall_feedback: { html: constructOverallFeedbackHtml(), - persistent: true, + persistent: false, buttons: {}, closeText: '', focus: "div[id='stars']", @@ -161,7 +185,7 @@ var Feedback = { var feedbackDialog = APP.UI.messageHandler.openDialogWithStates( states, - { persistent: true, + { persistent: false, buttons: {}, closeText: '', loaded: onLoadFunction, diff --git a/modules/UI/UI.js b/modules/UI/UI.js index 637256394..8cbb07709 100644 --- a/modules/UI/UI.js +++ b/modules/UI/UI.js @@ -429,15 +429,12 @@ UI.start = function (init) { $("#downloadlog").click(function (event) { dump(event.target); }); - $("#feedbackButton").click(function (event) { - Feedback.openFeedbackWindow(); - }); + Feedback.init(); } else { $("#header").css("display", "none"); $("#bottomToolbar").css("display", "none"); - $("#feedbackButton").css("display", "none"); $("#downloadlog").css("display", "none"); $("#remoteVideos").css("padding", "0px 0px 18px 0px"); $("#remoteVideos").css("right", "0px"); diff --git a/modules/UI/toolbars/Toolbar.js b/modules/UI/toolbars/Toolbar.js index 03949b09f..092858101 100644 --- a/modules/UI/toolbars/Toolbar.js +++ b/modules/UI/toolbars/Toolbar.js @@ -151,12 +151,28 @@ function hangup() { } }; - if (Feedback.feedbackScore > 0) { - Feedback.openFeedbackWindow(); - conferenceDispose(); + if (Feedback.isEnabled()) + { + // If the user has already entered feedback, we'll show the window and + // immidiately start the conference dispose timeout. + if (Feedback.feedbackScore > 0) { + Feedback.openFeedbackWindow(); + conferenceDispose(); + + } + // Otherwise we'll wait for user's feedback. + else + Feedback.openFeedbackWindow(conferenceDispose); + } + else { + conferenceDispose(); + + // If the feedback functionality isn't enabled we show a thank you + // dialog. + APP.UI.messageHandler.openMessageDialog(null, null, null, + APP.translation.translateString("dialog.thankYou", + {appName:interfaceConfig.APP_NAME})); } - else - Feedback.openFeedbackWindow(conferenceDispose); } /**