1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-11-23 22:36:32 +02:00

All: Resolves #3157: Also duplicate the tags when the note is duplicated (#4876)

This commit is contained in:
JackGruber
2021-04-24 10:16:36 +02:00
committed by GitHub
parent a67eab46f4
commit 0aef1f95ef
2 changed files with 25 additions and 1 deletions

View File

@@ -6,6 +6,7 @@ import shim from '../shim';
import time from '../time';
import markdownUtils from '../markdownUtils';
import { NoteEntity } from '../services/database/types';
import Tag from './Tag';
const { sprintf } = require('sprintf-js');
import Resource from './Resource';
@@ -615,7 +616,13 @@ export default class Note extends BaseItem {
newNote.title = title;
}
return this.save(newNote);
const newNoteSaved = await this.save(newNote);
const originalTags = await Tag.tagsByNoteId(noteId);
for (const tagToAdd of originalTags) {
await Tag.addNote(tagToAdd.id, newNoteSaved.id);
}
return this.save(newNoteSaved);
}
static async noteIsOlderThan(noteId: string, date: number) {