Fix missing teams in the share modal

pull/1/head
yflory 5 years ago
parent 722d813e97
commit 5dcc7643da

@ -882,7 +882,7 @@ define([
// config.teamId only exists when we're trying to share a pad from a team drive // config.teamId only exists when we're trying to share a pad from a team drive
// In this case, we don't want to share the pad with the current team // In this case, we don't want to share the pad with the current team
if (config.teamId && config.teamId === id) { return; } if (config.teamId && config.teamId === id) { return; }
if (!teamsData[id].secondaryKey) { return; } if (!teamsData[id].hasSecondaryKey) { return; }
var t = teamsData[id]; var t = teamsData[id];
teams[t.edPublic] = { teams[t.edPublic] = {
notifications: true, notifications: true,

@ -1888,9 +1888,16 @@ define([
var $password = $passwordIcon.clone().appendTo($state); var $password = $passwordIcon.clone().appendTo($state);
$password.attr('title', Messages.fm_passwordProtected || ''); $password.attr('title', Messages.fm_passwordProtected || '');
} }
if (hrefData.hashData && hrefData.hashData.mode === 'view') {
var $ro = $readonlyIcon.clone().appendTo($state);
$ro.attr('title', Messages.readonly);
}
var $shared = $sharedIcon.clone().appendTo($state); var $shared = $sharedIcon.clone().appendTo($state);
$shared.attr('title', Messages.fm_canBeShared); $shared.attr('title', Messages.fm_canBeShared);
} else if ($content.data('readOnlyFolder') || APP.readOnly) {
var $ro = $readonlyIcon.clone().appendTo($state);
$ro.attr('title', Messages.readonly);
} }
var sf = manager.hasSubfolder(element); var sf = manager.hasSubfolder(element);
@ -2559,6 +2566,10 @@ define([
viewHash: ro && roParsed.hash, viewHash: ro && roParsed.hash,
} }
}); });
// If we're a viewer and this is an old shared folder (no read-only mode), we
// can't share the read-only URL and we don't have access to the edit one.
// We should hide the share button.
if (!modal) { return; }
modal = UI.dialog.tabs(modal); modal = UI.dialog.tabs(modal);
$shareBlock.click(function () { $shareBlock.click(function () {
UI.openCustomModal(modal, { UI.openCustomModal(modal, {
@ -4079,7 +4090,6 @@ 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 ro = !sf || (folders[el] && folders[el].version >= 2); var ro = !sf || (folders[el] && folders[el].version >= 2);
console.log(folders[el]);
var padData = { var padData = {
teamId: APP.team, teamId: APP.team,
origin: APP.origin, origin: APP.origin,

@ -1309,6 +1309,9 @@ define([
if (safe && ctx.teams[id]) { if (safe && ctx.teams[id]) {
t[id].secondaryKey = ctx.teams[id].secondaryKey; t[id].secondaryKey = ctx.teams[id].secondaryKey;
} }
if (ctx.teams[id]) {
t[id].hasSecondaryKey = Boolean(ctx.teams[id].secondaryKey);
}
}); });
return t; return t;
}; };

Loading…
Cancel
Save