Prevent sharing a pad with a team from this team's drive

pull/1/head
yflory 5 years ago
parent b76cef9660
commit 799d93eb48

@ -766,6 +766,7 @@ define([
var teamsData = Util.tryParse(JSON.stringify(privateData.teams)) || {}; var teamsData = Util.tryParse(JSON.stringify(privateData.teams)) || {};
var teams = {}; var teams = {};
Object.keys(teamsData).forEach(function (id) { Object.keys(teamsData).forEach(function (id) {
if (config.teamId && config.teamId === id) { return; }
var t = teamsData[id]; var t = teamsData[id];
teams[t.edPublic] = { teams[t.edPublic] = {
notifications: true, notifications: true,

@ -516,7 +516,6 @@ define([
// Initialization // Initialization
Util.extend(APP, driveConfig.APP); Util.extend(APP, driveConfig.APP);
var teamId = APP.teamId = driveConfig.teamId;
var proxy = driveConfig.proxy; var proxy = driveConfig.proxy;
var folders = driveConfig.folders; var folders = driveConfig.folders;
var files = proxy.drive; var files = proxy.drive;
@ -533,7 +532,7 @@ define([
config.sframeChan = sframeChan; config.sframeChan = sframeChan;
var manager = ProxyManager.createInner(files, sframeChan, edPublic, config); var manager = ProxyManager.createInner(files, sframeChan, edPublic, config);
var LS = makeLS(teamId); var LS = makeLS(APP.team);
Object.keys(folders).forEach(function (id) { Object.keys(folders).forEach(function (id) {
var f = folders[id]; var f = folders[id];
@ -2480,7 +2479,10 @@ define([
var parsed = Hash.parsePadUrl(data.href); var parsed = Hash.parsePadUrl(data.href);
if (!parsed || !parsed.hash) { return void console.error("Invalid href: "+data.href); } if (!parsed || !parsed.hash) { return void console.error("Invalid href: "+data.href); }
var friends = common.getFriends(); var friends = common.getFriends();
var teams = common.getMetadataMgr().getPrivateData().teams;
var _wide = Object.keys(friends).length || Object.keys(teams).length;
var modal = UIElements.createSFShareModal({ var modal = UIElements.createSFShareModal({
teamId: APP.team,
origin: APP.origin, origin: APP.origin,
pathname: "/drive/", pathname: "/drive/",
friends: friends, friends: friends,
@ -2493,7 +2495,7 @@ define([
}); });
$shareBlock.click(function () { $shareBlock.click(function () {
UI.openCustomModal(modal, { UI.openCustomModal(modal, {
wide: Object.keys(friends).length !== 0 wide: _wide
}); });
}); });
$container.append($shareBlock); $container.append($shareBlock);
@ -3913,11 +3915,14 @@ define([
el = manager.find(paths[0].path); el = manager.find(paths[0].path);
var parsed, modal; var parsed, modal;
var friends = common.getFriends(); var friends = common.getFriends();
var teams = common.getMetadataMgr().getPrivateData().teams;
var _wide = Object.keys(friends).length || Object.keys(teams).length;
if (manager.isSharedFolder(el)) { if (manager.isSharedFolder(el)) {
data = manager.getSharedFolderData(el); data = manager.getSharedFolderData(el);
parsed = Hash.parsePadUrl(data.href); parsed = Hash.parsePadUrl(data.href);
modal = UIElements.createSFShareModal({ modal = UIElements.createSFShareModal({
teamId: APP.team,
origin: APP.origin, origin: APP.origin,
pathname: "/drive/", pathname: "/drive/",
friends: friends, friends: friends,
@ -3929,7 +3934,7 @@ define([
} }
}); });
return void UI.openCustomModal(modal, { return void UI.openCustomModal(modal, {
wide: Object.keys(friends).length !== 0 wide: _wide
}); });
} else if (manager.isFolder(el)) { // Folder } else if (manager.isFolder(el)) { // Folder
// if folder is inside SF // if folder is inside SF
@ -3971,6 +3976,7 @@ define([
var roParsed = Hash.parsePadUrl(data.roHref); var roParsed = Hash.parsePadUrl(data.roHref);
var padType = parsed.type || roParsed.type; var padType = parsed.type || roParsed.type;
var padData = { var padData = {
teamId: APP.team,
origin: APP.origin, origin: APP.origin,
pathname: "/" + padType + "/", pathname: "/" + padType + "/",
friends: friends, friends: friends,
@ -3992,7 +3998,7 @@ define([
: UIElements.createShareModal(padData); : UIElements.createShareModal(padData);
modal = UI.dialog.tabs(modal); modal = UI.dialog.tabs(modal);
UI.openCustomModal(modal, { UI.openCustomModal(modal, {
wide: Object.keys(friends).length !== 0 wide: _wide
}); });
} }
} }

@ -38,6 +38,8 @@ define([
: UIElements.createShareModal; : UIElements.createShareModal;
var friends = common.getFriends(); var friends = common.getFriends();
var teams = priv.teams;
var _wide = Object.keys(friends).length || Object.keys(teams).length;
var modal = f({ var modal = f({
origin: origin, origin: origin,
@ -58,7 +60,7 @@ define([
}); });
$('button.cancel').click(); // Close any existing alertify $('button.cancel').click(); // Close any existing alertify
UI.openCustomModal(UI.dialog.tabs(modal), { UI.openCustomModal(UI.dialog.tabs(modal), {
wide: Object.keys(friends).length !== 0 wide: _wide
}); });
}; };
sframeChan.on('EV_SHARE_REFRESH', function (data) { sframeChan.on('EV_SHARE_REFRESH', function (data) {

Loading…
Cancel
Save