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

pull/793/head
Laurent Cozic 2018-09-13 20:53:31 +01:00
parent 9664842b1a
commit 5ab1d8dfd6
1 changed files with 13 additions and 4 deletions

View File

@ -220,10 +220,19 @@ class Folder extends BaseItem {
}
}
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));
}
// We allow folders with duplicate titles so that folders with the same title can exist under different parent folder. For example:
//
// 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 (o.title == Folder.conflictFolderTitle()) throw new Error(_('Notebooks cannot be named "%s", which is a reserved title.', o.title));