Disables feedback functionality if callstats isn't available.

This commit is contained in:
yanas 2015-11-16 18:06:28 -06:00
parent 0ae702922c
commit 7ea675159e
4 changed files with 50 additions and 12 deletions

View File

@ -248,6 +248,7 @@ form {
}
div.feedbackButton {
display: none;
position: absolute;
background-color: rgba(0,0,0,.50);
border-radius: 50%;

View File

@ -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,

View File

@ -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");

View File

@ -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);
}
/**