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
commit 38e28ebc9a
12 changed files with 85 additions and 69 deletions

View File

@ -156,7 +156,7 @@ define(function () {
out.filePickerButton = "Intégrer un fichier stocké dans CryptDrive"; out.filePickerButton = "Intégrer un fichier stocké dans CryptDrive";
out.filePicker_close = "Fermer"; out.filePicker_close = "Fermer";
out.filePicker_description = "Choisissez un fichier de votre CryptDrive pour l'intégrer ou uploadez-en un nouveau"; out.filePicker_description = "Choisissez un fichier de votre CryptDrive pour l'intégrer ou importez-en un nouveau";
out.filePicker_filter = "Filtrez les fichiers par leur nom"; out.filePicker_filter = "Filtrez les fichiers par leur nom";
out.or = 'ou'; out.or = 'ou';

View File

@ -50,7 +50,7 @@
height: 100%; height: 100%;
overflow: hidden; overflow: hidden;
&.cp-app-code-present { &.cp-app-code-present {
.CodeMirror { display: none; } #cp-app-code-container { display: none; }
#cp-app-code-preview { border: 0; } #cp-app-code-preview { border: 0; }
} }
} }

View File

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

View File

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

View File

@ -105,7 +105,8 @@ define([
if (parsed) { if (parsed) {
var proxy = proxyData.proxy; var proxy = proxyData.proxy;
var oldFo = FO.init(parsed.drive, { 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 () { var onMigrated = function () {
oldFo.fixFiles(); oldFo.fixFiles();

View File

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

View File

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

View File

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

View File

@ -2233,6 +2233,9 @@ define([
appStatus.ready(true); appStatus.ready(true);
}; };
var displayDirectory = APP.displayDirectory = function (path, force) { var displayDirectory = APP.displayDirectory = function (path, force) {
if (history.isHistoryMode) {
return void _displayDirectory(path, force);
}
updateObject(sframeChan, proxy, function () { updateObject(sframeChan, proxy, function () {
copyObjectValue(files, proxy.drive); copyObjectValue(files, proxy.drive);
_displayDirectory(path, force); _displayDirectory(path, force);
@ -2635,6 +2638,10 @@ define([
APP.hideMenu(); APP.hideMenu();
}); });
if (!APP.loggedIn) {
$defaultContextMenu.find('.cp-app-drive-context-delete').text(Messages.fc_remove)
.attr('data-icon', 'fa-eraser');
}
$defaultContextMenu.on("click", "a", function(e) { $defaultContextMenu.on("click", "a", function(e) {
e.stopPropagation(); e.stopPropagation();
var paths = $(this).data('paths'); var paths = $(this).data('paths');
@ -2902,14 +2909,12 @@ define([
}); });
history.onEnterHistory = function (obj) { history.onEnterHistory = function (obj) {
var files = obj.drive; copyObjectValue(files, obj.drive);
filesOp = FO.init(files, config);
appStatus.isReady = true; appStatus.isReady = true;
refresh(); refresh();
}; };
history.onLeaveHistory = function () { history.onLeaveHistory = function () {
var files = proxy.drive; copyObjectValue(files, proxy.drive);
filesOp = FO.init(files, config);
refresh(); refresh();
}; };

View File

@ -1142,6 +1142,7 @@ define([
APP.$publishButton = $publish; APP.$publishButton = $publish;
updatePublishButton(); updatePublishButton();
if (common.isLoggedIn()) {
var fileDialogCfg = { var fileDialogCfg = {
onSelect: function (data) { onSelect: function (data) {
if (data.type === 'file' && APP.editor) { if (data.type === 'file' && APP.editor) {
@ -1163,6 +1164,7 @@ define([
}; };
common.openFilePicker(pickerCfg); common.openFilePicker(pickerCfg);
}).appendTo($rightside); }).appendTo($rightside);
}
var $tags = common.createButton('hashtag', true); var $tags = common.createButton('hashtag', true);
$rightside.append($tags); $rightside.append($tags);

View File

@ -40,7 +40,7 @@ define([
Cryptpad.getTodoHash(function (hash) { Cryptpad.getTodoHash(function (hash) {
var nHash = hash || Utils.Hash.createRandomHash(); var nHash = hash || Utils.Hash.createRandomHash();
if (!hash) { Cryptpad.setTodoHash(nHash); } if (!hash) { Cryptpad.setTodoHash(nHash); }
cb(null, Utils.Hash.getSecrets('todo', hash)); cb(null, Utils.Hash.getSecrets('todo', nHash));
}); });
}; };
SFCommonO.start({ SFCommonO.start({

View File

@ -470,6 +470,8 @@ define([
.click(function () { .click(function () {
$('<input>', {type:'file'}).on('change', onUpload).click(); $('<input>', {type:'file'}).on('change', onUpload).click();
}).appendTo($rightside); }).appendTo($rightside);
if (common.isLoggedIn()) {
var fileDialogCfg = { var fileDialogCfg = {
onSelect: function (data) { onSelect: function (data) {
if (data.type === 'file') { if (data.type === 'file') {
@ -501,6 +503,7 @@ define([
common.openFilePicker(pickerCfg); common.openFilePicker(pickerCfg);
}).appendTo($rightside); }).appendTo($rightside);
} }
}
metadataMgr.onChange(function () { metadataMgr.onChange(function () {
var md = metadataMgr.getMetadata(); var md = metadataMgr.getMetadata();