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

This commit is contained in:
ansuz
2017-12-15 19:12:00 +01:00
12 changed files with 85 additions and 69 deletions

View File

@@ -55,6 +55,7 @@
};
var stopListening = UI.stopListening = function (handler) {
if (!handler) { return; } // we don't want to stop all the 'keyup' listeners
$(window).off('keyup', handler);
};
@@ -219,7 +220,7 @@
var $cancel = findCancelButton(tagger).click(function (e) {
close(null, e);
});
listenForKeys(function () {
listener = listenForKeys(function () {
$ok.click();
}, function () {
$cancel.click();

View File

@@ -464,6 +464,11 @@ define([
common.onNetworkDisconnect = Util.mkEvent();
common.onNetworkReconnect = Util.mkEvent();
// Messaging
var messaging = common.messaging = {};
messaging.onFriendRequest = Util.mkEvent();
messaging.onFriendComplete = Util.mkEvent();
// Messenger
var messenger = common.messenger = {};
messenger.getFriendList = function (cb) {
@@ -600,13 +605,11 @@ define([
break;
}
case 'Q_FRIEND_REQUEST': {
if (!common.onFriendRequest) { break; }
common.onFriendRequest(data, cb);
common.messaging.onFriendRequest.fire(data, cb);
break;
}
case 'EV_FRIEND_COMPLETE': {
if (!common.onFriendComplete) { break; }
common.onFriendComplete(data);
common.messaging.onFriendComplete.fire(data);
break;
}
// Network

View File

@@ -105,7 +105,8 @@ define([
if (parsed) {
var proxy = proxyData.proxy;
var oldFo = FO.init(parsed.drive, {
loggedIn: proxyData.loggedIn
loggedIn: proxyData.loggedIn,
pinPads: function () {} // without pinPads /outer/userObject.js won't be loaded
});
var onMigrated = function () {
oldFo.fixFiles();

View File

@@ -616,11 +616,11 @@ define([
postMessage("UPDATE_METADATA");
},
pinPads: Store.pinPads,
friendComplete: function (data, cb) {
postMessage("Q_FRIEND_COMPLETE", data, cb);
friendComplete: function (data) {
postMessage("EV_FRIEND_COMPLETE", data);
},
friendRequest: function (data) {
postMessage("EV_FRIEND_REQUEST", data);
friendRequest: function (data, cb) {
postMessage("Q_FRIEND_REQUEST", data, cb);
},
};
};

View File

@@ -342,6 +342,7 @@ define([
};
var createFilePicker = function () {
if (!common.isLoggedIn()) { return; }
common.initFilePicker({
onSelect: function (data) {
if (data.type !== 'file') {
@@ -369,6 +370,7 @@ define([
}).appendTo(toolbar.$rightside).hide();
};
var setMediaTagEmbedder = function (mte) {
if (!common.isLoggedIn()) { return; }
if (!mte || readOnly) {
$embedButton.hide();
return;

View File

@@ -307,17 +307,16 @@ define([
});
sframeChan.on('Q_SEND_FRIEND_REQUEST', function (netfluxId, cb) {
Messaging.inviteFromUserlist(Cryptpad, netfluxId);
cb();
Cryptpad.inviteFromUserlist(netfluxId, cb);
});
Cryptpad.onFriendRequest = function (confirmText, cb) {
Cryptpad.messaging.onFriendRequest.reg(function (confirmText, cb) {
sframeChan.query('Q_INCOMING_FRIEND_REQUEST', confirmText, function (err, data) {
cb(data);
});
};
Cryptpad.onFriendComplete = function (data) {
});
Cryptpad.messaging.onFriendComplete.reg(function (data) {
sframeChan.event('EV_FRIEND_REQUEST', data);
};
});
sframeChan.on('Q_GET_FULL_HISTORY', function (data, cb) {
var crypto = Crypto.createEncryptor(secret.keys);