Hide duplicated owned pads
This commit is contained in:
@@ -885,6 +885,7 @@ define([
|
||||
if (fPath) {
|
||||
// This is a shared folder, we have to fix the paths in the search results
|
||||
results.forEach(function (r) {
|
||||
r.inSharedFolder = true;
|
||||
r.paths.forEach(function (p) {
|
||||
Array.prototype.unshift.apply(p, fPath);
|
||||
});
|
||||
@@ -899,8 +900,8 @@ define([
|
||||
var getRecentPads = function (Env) {
|
||||
return Env.user.userObject.getRecentPads();
|
||||
};
|
||||
var getOwnedPads = function (Env, edPublic) {
|
||||
return Env.user.userObject.getOwnedPads(edPublic);
|
||||
var getOwnedPads = function (Env) {
|
||||
return Env.user.userObject.getOwnedPads(Env.edPublic);
|
||||
};
|
||||
|
||||
var getSharedFolderData = function (Env, id) {
|
||||
@@ -961,10 +962,27 @@ define([
|
||||
return Env.user.userObject.hasFile(el, trashRoot);
|
||||
};
|
||||
|
||||
var createInner = function (proxy, sframeChan, uoConfig) {
|
||||
// Get the owned files in the main drive that are also duplicated in shared folders
|
||||
var isDuplicateOwned = function (Env, path) {
|
||||
if (isInSharedFolder(Env, path)) { return; }
|
||||
var data = getFileData(Env, Env.user.userObject.find(path));
|
||||
if (!data) { return; }
|
||||
if (!_ownedByMe(Env, data.owners)) { return; }
|
||||
var channel = data.channel;
|
||||
if (!channel) { return; }
|
||||
var foldersUO = Object.keys(Env.folders).map(function (k) {
|
||||
return Env.folders[k].userObject;
|
||||
});
|
||||
return foldersUO.some(function (uo) {
|
||||
return uo.findChannels([channel]).length;
|
||||
});
|
||||
};
|
||||
|
||||
var createInner = function (proxy, sframeChan, edPublic, uoConfig) {
|
||||
var Env = {
|
||||
cfg: uoConfig,
|
||||
sframeChan: sframeChan,
|
||||
edPublic: edPublic,
|
||||
user: {
|
||||
proxy: proxy,
|
||||
userObject: UserObject.init(proxy, uoConfig)
|
||||
@@ -1006,6 +1024,7 @@ define([
|
||||
getSharedFolderData: callWithEnv(getSharedFolderData),
|
||||
isInSharedFolder: callWithEnv(isInSharedFolder),
|
||||
getUserObjectPath: callWithEnv(getUserObjectPath),
|
||||
isDuplicateOwned: callWithEnv(isDuplicateOwned),
|
||||
// Generic
|
||||
isFile: callWithEnv(isFile),
|
||||
isFolder: callWithEnv(isFolder),
|
||||
|
||||
@@ -275,7 +275,7 @@ define([
|
||||
forceCreationScreen: forceCreationScreen,
|
||||
password: password,
|
||||
channel: secret.channel,
|
||||
enableSF: localStorage.CryptPad_SF === "1" // TODO to remove when enabled by default
|
||||
enableSF: localStorage.CryptPad_SF === "1", // TODO to remove when enabled by default
|
||||
};
|
||||
if (window.CryptPad_newSharedFolder) {
|
||||
additionalPriv.newSharedFolder = window.CryptPad_newSharedFolder;
|
||||
|
||||
@@ -646,6 +646,10 @@ define(function () {
|
||||
out.settings_logoutEverywhere = "Force log out of all other web sessions";
|
||||
out.settings_logoutEverywhereConfirm = "Are you sure? You will need to log in with all your devices.";
|
||||
|
||||
out.settings_driveDuplicateTitle = "Duplicated owned pads";
|
||||
out.settings_driveDuplicateHint = "To make sure you always have control over your owned pads, whenever you try to move one into a shared folder, a copy is kept in your drive. You can choose here to hide these duplicated files. You will only see the version stored the shared folder until it is removed from the shared folder or the shared folder itself is removed, then the copy will reappear.";
|
||||
out.settings_driveDuplicateLabel = "Hide duplicates";
|
||||
|
||||
out.settings_codeIndentation = 'Code editor indentation (spaces)';
|
||||
out.settings_codeUseTabs = "Indent using tabs (instead of spaces)";
|
||||
out.settings_codeFontSize = "Font size in the code editor";
|
||||
|
||||
Reference in New Issue
Block a user