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 teams = {};
Object.keys(teamsData).forEach(function (id) {
if (config.teamId && config.teamId === id) { return; }
var t = teamsData[id];
teams[t.edPublic] = {
notifications: true,

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

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

Loading…
Cancel
Save