Add an error message when trying to tag a deleted pad

pull/1/head
yflory 7 years ago
parent 69dd3a60ab
commit 62bc72847f

@ -162,6 +162,7 @@ define(function () {
out.tags_searchHint = "Commencez une recherche par # dans votre CryptDrive pour retrouver vos pads par mot-clé."; out.tags_searchHint = "Commencez une recherche par # dans votre CryptDrive pour retrouver vos pads par mot-clé.";
out.tags_notShared = "Vos mots-clés ne sont pas partagés avec les autres utilisateurs."; out.tags_notShared = "Vos mots-clés ne sont pas partagés avec les autres utilisateurs.";
out.tags_duplicate = "Mot-clé déjà présent : {0}"; out.tags_duplicate = "Mot-clé déjà présent : {0}";
out.tags_noentry = "Vous ne pouvez pas ajouter de mots-clés à un pad supprimé!";
out.slideOptionsText = "Options"; out.slideOptionsText = "Options";
out.slideOptionsTitle = "Personnaliser la présentation"; out.slideOptionsTitle = "Personnaliser la présentation";

@ -164,8 +164,8 @@ define(function () {
out.tags_searchHint = "Find files by their tags by searching in your CryptDrive"; out.tags_searchHint = "Find files by their tags by searching in your CryptDrive";
out.tags_searchHint = "Start a search with # in your CryptDrive to find your tagged pads."; out.tags_searchHint = "Start a search with # in your CryptDrive to find your tagged pads.";
out.tags_notShared = "Your tags are not shared with other users"; out.tags_notShared = "Your tags are not shared with other users";
out.tags_duplicate = "Duplicate tag: {0}"; out.tags_duplicate = "Duplicate tag: {0}";
out.tags_noentry = "You can't tag a deleted pad!";
out.slideOptionsText = "Options"; out.slideOptionsText = "Options";
out.slideOptionsTitle = "Customize your slides"; out.slideOptionsTitle = "Customize your slides";

@ -31,7 +31,12 @@ define([
UI.updateTags = function (common, href) { UI.updateTags = function (common, href) {
var sframeChan = common.getSframeChannel(); var sframeChan = common.getSframeChannel();
sframeChan.query('Q_TAGS_GET', href || null, function (err, res) { sframeChan.query('Q_TAGS_GET', href || null, function (err, res) {
if (err || res.error) { return void console.error(err || res.error); } if (err || res.error) {
if (res.error === 'NO_ENTRY') {
Cryptpad.alert(Messages.tags_noentry);
}
return void console.error(err || res.error);
}
Cryptpad.dialog.tagPrompt(res.data, function (tags) { Cryptpad.dialog.tagPrompt(res.data, function (tags) {
if (!Array.isArray(tags)) { return; } if (!Array.isArray(tags)) { return; }
sframeChan.event('EV_TAGS_SET', { sframeChan.event('EV_TAGS_SET', {

@ -499,7 +499,6 @@ define([
}); });
}; };
var spliceFileData = exp.removeData = function (id) { var spliceFileData = exp.removeData = function (id) {
files[FILES_DATA][id] = undefined;
delete files[FILES_DATA][id]; delete files[FILES_DATA][id];
}; };
@ -649,7 +648,6 @@ define([
var hash = f.indexOf('#') !== -1 ? f.slice(f.indexOf('#') + 1) : null; var hash = f.indexOf('#') !== -1 ? f.slice(f.indexOf('#') + 1) : null;
if (hash && key.indexOf(hash) === 0) { if (hash && key.indexOf(hash) === 0) {
debug("Deleting pad attribute in the realtime object"); debug("Deleting pad attribute in the realtime object");
files[key] = undefined;
delete files[key]; delete files[key];
} }
}); });
@ -709,7 +707,6 @@ define([
var parentPath = path.slice(); var parentPath = path.slice();
var key = parentPath.pop(); var key = parentPath.pop();
var parentEl = find(parentPath); var parentEl = find(parentPath);
parentEl[key] = undefined;
delete parentEl[key]; delete parentEl[key];
}); });
@ -728,7 +725,6 @@ define([
return; return;
} }
// Trash but not root: it's just a tree so remove the key // Trash but not root: it's just a tree so remove the key
parentEl[key] = undefined;
delete parentEl[key]; delete parentEl[key];
}); });
deleteMultipleTrashRoot(trashRoot); deleteMultipleTrashRoot(trashRoot);
@ -767,7 +763,6 @@ define([
return; return;
} }
parentEl[newName] = element; parentEl[newName] = element;
parentEl[oldName] = undefined;
delete parentEl[oldName]; delete parentEl[oldName];
if (typeof cb === "function") { cb(); } if (typeof cb === "function") { cb(); }
return; return;
@ -777,7 +772,6 @@ define([
var data = files[FILES_DATA][element]; var data = files[FILES_DATA][element];
if (!data) { return; } if (!data) { return; }
if (!newName || newName.trim() === "") { if (!newName || newName.trim() === "") {
data.filename = undefined;
delete data.filename; delete data.filename;
if (typeof cb === "function") { cb(); } if (typeof cb === "function") { cb(); }
return; return;
@ -899,9 +893,7 @@ define([
delete parent[okey]; delete parent[okey];
}); });
}); });
files[OLD_FILES_DATA] = undefined;
delete files[OLD_FILES_DATA]; delete files[OLD_FILES_DATA];
files.migrate = undefined;
delete files.migrate; delete files.migrate;
console.log('done'); console.log('done');
todo(); todo();
@ -942,7 +934,6 @@ define([
for (var el in element) { for (var el in element) {
if (!isFile(element[el], true) && !isFolder(element[el])) { if (!isFile(element[el], true) && !isFolder(element[el])) {
debug("An element in ROOT was not a folder nor a file. ", element[el]); debug("An element in ROOT was not a folder nor a file. ", element[el]);
element[el] = undefined;
delete element[el]; delete element[el];
continue; continue;
} }
@ -994,11 +985,9 @@ define([
for (var el in tr) { for (var el in tr) {
if (!Array.isArray(tr[el])) { if (!Array.isArray(tr[el])) {
debug("An element in TRASH root is not an array. ", tr[el]); debug("An element in TRASH root is not an array. ", tr[el]);
tr[el] = undefined;
delete tr[el]; delete tr[el];
} else if (tr[el].length === 0) { } else if (tr[el].length === 0) {
debug("Empty array in TRASH root. ", tr[el]); debug("Empty array in TRASH root. ", tr[el]);
tr[el] = undefined;
delete tr[el]; delete tr[el];
} else { } else {
toClean = []; toClean = [];

Loading…
Cancel
Save