mirror of https://github.com/laurent22/joplin.git
All: Do no duplicate resources when duplicating a note
parent
ab5d799f3d
commit
721d00874f
|
@ -153,7 +153,7 @@ describe('models/Note', function() {
|
|||
const resource = (await Resource.all())[0];
|
||||
expect((await Resource.all()).length).toBe(1);
|
||||
|
||||
const duplicatedNote = await Note.duplicate(note.id);
|
||||
const duplicatedNote = await Note.duplicate(note.id, { duplicateResources: true });
|
||||
|
||||
const resources: ResourceEntity[] = await Resource.all();
|
||||
expect(resources.length).toBe(2);
|
||||
|
|
|
@ -611,6 +611,7 @@ export default class Note extends BaseItem {
|
|||
public static async duplicate(noteId: string, options: any = null) {
|
||||
const changes = options && options.changes;
|
||||
const uniqueTitle = options && options.uniqueTitle;
|
||||
const duplicateResources = options && !!options.duplicateResources;
|
||||
|
||||
const originalNote: NoteEntity = await Note.load(noteId);
|
||||
if (!originalNote) throw new Error(`Unknown note: ${noteId}`);
|
||||
|
@ -632,7 +633,7 @@ export default class Note extends BaseItem {
|
|||
newNote.title = title;
|
||||
}
|
||||
|
||||
newNote.body = await this.duplicateNoteResources(newNote.body);
|
||||
if (duplicateResources) newNote.body = await this.duplicateNoteResources(newNote.body);
|
||||
|
||||
const newNoteSaved = await this.save(newNote);
|
||||
const originalTags = await Tag.tagsByNoteId(noteId);
|
||||
|
|
Loading…
Reference in New Issue