Fix shared folders names in the drive

This commit is contained in:
yflory
2018-07-09 18:11:04 +02:00
parent e0cc1a6eb6
commit 6312dadb60
6 changed files with 77 additions and 8 deletions

View File

@@ -103,6 +103,14 @@ define([
common.userObjectCommand = function (data, cb) {
postMessage("DRIVE_USEROBJECT", data, cb);
};
common.restoreDrive = function (data, cb) {
postMessage("SET", {
key:['drive'],
value: data
}, function (obj) {
cb(obj);
});
};
common.drive = {};
common.drive.onLog = Util.mkEvent();
common.drive.onChange = Util.mkEvent();

View File

@@ -1173,6 +1173,8 @@ define([
var id;
nThen(function (waitFor) {
// TODO XXX get the folder data (href, title, ...)
// XXX href should be stored in your drive's .sharedFolders
// and title should be stored in the sharef folder's metadata
var folderData = data.folderData || {};
// 1. add the shared folder to our list of shared folders
store.userObject.pushSharedFolder(folderData, waitFor(function (err, folderId) {

View File

@@ -677,6 +677,15 @@ define([
return Env.user.userObject.getOwnedPads(edPublic);
};
var getSharedFolderData = function (Env, id) {
if (!Env.folders[id]) { return; }
var obj = Env.folders[id].proxy.metadata || {};
for (var k in Env.user.proxy[UserObject.SHARED_FOLDERS][id] || {}) {
obj[k] = Env.user.proxy[UserObject.SHARED_FOLDERS][id][k];
}
return obj;
};
/* Generic: doesn't need access to a proxy */
var isFile = function (Env, el, allowStr) {
return Env.user.userObject.isFile(el, allowStr);
@@ -762,6 +771,7 @@ define([
getTagsList: callWithEnv(getTagsList),
findFile: callWithEnv(findFile),
findChannels: callWithEnv(findChannels),
getSharedFolderData: callWithEnv(getSharedFolderData),
// Generic
isFile: callWithEnv(isFile),
isFolder: callWithEnv(isFolder),

View File

@@ -203,6 +203,7 @@ define({
// Inner drive needs to send command and receive updates from the async store
'Q_DRIVE_USEROBJECT': true,
'Q_DRIVE_GETOBJECT': true,
'Q_DRIVE_RESTORE': true,
// Get the pads deleted from the server by other users to remove them from the drive
'Q_DRIVE_GETDELETED': true,
// Store's userObject need to send log messages to inner to display them in the UI