Merge branch 'pad2' of github.com:xwiki-labs/cryptpad into pad2

This commit is contained in:
Caleb James DeLisle
2017-08-23 10:21:53 +02:00
9 changed files with 171 additions and 14 deletions

View File

@@ -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; }

View File

@@ -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 () {

View File

@@ -161,6 +161,7 @@ define([
var metadataMgr = config.metadataMgr;
var userData = metadataMgr.getMetadata().users;
var viewers = metadataMgr.getViewers();
var origin = config.metadataMgr.getPrivateData().origin;
// If we are using old pads (readonly unavailable), only editing users are in userList.
// With new pads, we also have readonly users in userList, so we have to intersect with
@@ -225,7 +226,7 @@ define([
if (data.profile) {
$span.addClass('clickable');
$span.click(function () {
window.open('/profile/#' + data.profile);
window.open(origin+'/profile/#' + data.profile);
});
}
if (data.avatar && avatars[data.avatar]) {

View File

@@ -413,6 +413,15 @@ define([
});
return ret;
};
exp.getRecentPads = function () {
var allFiles = files[FILES_DATA];
var sorted = Object.keys(allFiles)
.sort(function (a,b) {
return allFiles[a].atime < allFiles[b].atime;
})
.map(function (str) { return Number(str); });
return sorted;
};
/**
* OPERATIONS