1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-12-27 10:32:58 +02:00

All: Resolves #781: Allow creating notebooks with duplicate titles to allow two notebooks with same name to exist under different parents

This commit is contained in:
Laurent Cozic 2018-09-13 20:53:31 +01:00
parent 9664842b1a
commit 5ab1d8dfd6

View File

@ -220,10 +220,19 @@ class Folder extends BaseItem {
} }
} }
if (options.duplicateCheck === true && o.title) { // We allow folders with duplicate titles so that folders with the same title can exist under different parent folder. For example:
let existingFolder = await Folder.loadByTitle(o.title); //
if (existingFolder && existingFolder.id != o.id) throw new Error(_('A notebook with this title already exists: "%s"', o.title)); // PHP
} // Code samples
// Doc
// Java
// My project
// Doc
// if (options.duplicateCheck === true && o.title) {
// let existingFolder = await Folder.loadByTitle(o.title);
// if (existingFolder && existingFolder.id != o.id) throw new Error(_('A notebook with this title already exists: "%s"', o.title));
// }
if (options.reservedTitleCheck === true && o.title) { if (options.reservedTitleCheck === true && o.title) {
if (o.title == Folder.conflictFolderTitle()) throw new Error(_('Notebooks cannot be named "%s", which is a reserved title.', o.title)); if (o.title == Folder.conflictFolderTitle()) throw new Error(_('Notebooks cannot be named "%s", which is a reserved title.', o.title));