Enable feedback in pad2

pull/1/head
yflory 7 years ago
parent e81bb3fe08
commit c33b128bf4

@ -205,6 +205,13 @@ define([
var randomToken = function () {
return Math.random().toString(16).replace(/0./, '');
};
common.isFeedbackAllowed = function () {
try {
if (!getStore().getProxy().proxy.allowUserFeedback) { return; }
return true;
} catch (e) { return void console.error(e); }
};
var feedback = common.feedback = function (action, force) {
if (force !== true) {
if (!action) { return; }

@ -101,10 +101,29 @@ define([
ctx.sframeChan.query('Q_GET_FULL_HISTORY', null, cb);
};
// TODO
funcs.feedback = function (action, force) {
if (force !== true) {
if (!action) { return; }
try {
if (!ctx.metadataMgr.getPrivateData().feedbackAllowed) { return; }
} catch (e) { return void console.error(e); }
}
var randomToken = Math.random().toString(16).replace(/0./, '');
var origin = ctx.metadataMgr.getPrivateData().origin;
var href = /*origin +*/ '/common/feedback.html?' + action + '=' + randomToken;
$.ajax({
type: "HEAD",
url: href,
});
};
var prepareFeedback = function (key) {
if (typeof(key) !== 'string') { return $.noop; }
funcs.feedback = function () {};
var prepareFeedback = function () {};
var type = ctx.metadataMgr.getMetadata().type;
return function () {
funcs.feedback((key + (type? '_' + type: '')).toUpperCase());
};
};
// BUTTONS
var isStrongestStored = function () {

@ -508,11 +508,11 @@ define([
$collapse.removeClass('fa-caret-down').removeClass('fa-caret-up');
var isCollapsed = !$bar.find('.cke_toolbox_main').is(':visible');
if (isCollapsed) {
if (!initializing) { Cryptpad.feedback('HIDETOOLBAR_PAD'); }
if (!initializing) { common.feedback('HIDETOOLBAR_PAD'); }
$collapse.addClass('fa-caret-down');
}
else {
if (!initializing) { Cryptpad.feedback('SHOWTOOLBAR_PAD'); }
if (!initializing) { common.feedback('SHOWTOOLBAR_PAD'); }
$collapse.addClass('fa-caret-up');
}
};
@ -701,7 +701,7 @@ define([
var id = classes[0];
if (typeof(id) === 'string') {
Cryptpad.feedback(id.toUpperCase());
common.feedback(id.toUpperCase());
}
});
};

@ -75,7 +75,8 @@ define([
pathname: window.location.pathname,
readOnly: readOnly,
availableHashes: hashes,
isTemplate: Cryptpad.isTemplate(window.location.href)
isTemplate: Cryptpad.isTemplate(window.location.href),
feedbackAllowed: Cryptpad.isFeedbackAllowed()
}
});
});

Loading…
Cancel
Save