Fix team editor

pull/1/head
yflory 5 years ago
parent d3b03f46ea
commit 13df7e8d38

@ -372,7 +372,8 @@ define([
common.getMetadata = function (cb) {
postMessage("GET_METADATA", null, function (obj) {
var parsed = Hash.parsePadUrl(window.location.href);
postMessage("GET_METADATA", parsed && parsed.type, function (obj) {
if (obj && obj.error) { return void cb(obj.error); }
cb(null, obj);
});

@ -526,6 +526,7 @@ define([
var files = proxy.drive;
var history = driveConfig.history || {};
var edPublic = driveConfig.edPublic || priv.edPublic;
config.editKey = driveConfig.editKey;
APP.origin = priv.origin;
APP.hideDuplicateOwned = Util.find(priv, ['settings', 'drive', 'hideDuplicate']);
APP.closed = false;

@ -550,9 +550,9 @@ define([
};
// Get the metadata for sframe-common-outer
Store.getMetadata = function (clientId, data, cb) {
Store.getMetadata = function (clientId, app, cb) {
var disableThumbnails = Util.find(store.proxy, ['settings', 'general', 'disableThumbnails']);
var teams = store.modules['team'] && store.modules['team'].getTeamsData();
var teams = store.modules['team'] && store.modules['team'].getTeamsData(app);
var metadata = {
// "user" is shared with everybody via the userlist
user: {

@ -253,12 +253,13 @@ define([
rt: team.realtime,
editKey: secret && secret.keys.secondaryKey
});
team.secondaryKey = secret && secret.keys.secondaryKey;
team.userObject = manager.user.userObject;
team.userObject.fixFiles();
}).nThen(function (waitFor) {
ctx.teams[id] = team;
registerChangeEvents(ctx, team, proxy);
SF.checkMigration(secret && secret.keys.secondaryKey, proxy, team.userObject, waitFor());
SF.checkMigration(team.secondaryKey, proxy, team.userObject, waitFor());
SF.loadSharedFolders(ctx.Store, ctx.store.network, team, team.userObject, waitFor);
}).nThen(function () {
if (!team.rpc) { return; }
@ -1109,8 +1110,10 @@ define([
team.getTeam = function (id) {
return ctx.teams[id];
};
team.getTeamsData = function () {
team.getTeamsData = function (app) {
var t = {};
var safe = false;
if (['drive', 'teams', 'settings'].indexOf(app) !== -1) { safe = true; }
Object.keys(teams).forEach(function (id) {
t[id] = {
owner: teams[id].owner,
@ -1118,6 +1121,9 @@ define([
edPublic: Util.find(teams[id], ['keys', 'drive', 'edPublic']),
avatar: Util.find(teams[id], ['metadata', 'avatar'])
};
if (safe) {
t[id].secondaryKey = ctx.teams[id].secondaryKey;
}
});
return t;
};

@ -241,6 +241,8 @@ define([
// Team APP
var loadTeam = function (common, id) {
var metadataMgr = common.getMetadataMgr();
var privateData = metadataMgr.getPrivateData();
var sframeChan = common.getSframeChannel();
var proxy = {};
var folders = {};
@ -261,11 +263,7 @@ define([
driveAPP.team = id;
// Provide secondaryKey
var teamData = (proxy.teams || {})[id];
var secret;
if (teamData) {
secret = Hash.getSecrets('team', teamData.hash, teamData.password);
}
var teamData = (privateData.teams || {})[id] || {};
var drive = DriveUI.create(common, {
proxy: proxy,
folders: folders,
@ -273,7 +271,7 @@ define([
updateSharedFolders: updateSharedFolders,
APP: driveAPP,
edPublic: APP.teamEdPublic,
editKey: secret && secret.keys.secondaryKey
editKey: teamData.secondaryKey
});
APP.drive = drive;
driveAPP.refresh = drive.refresh;

Loading…
Cancel
Save