You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-06-18 23:07:45 +02:00
* API: Fix updation of tags when updating a note * Add test for fix updation of tags * Rewrite unit test and change variable name * Use consistent variables and function calls * Use default function call and change variable * Handle case when tags is empty string * Restructure test cases and improve tags check * Update documentation
This commit is contained in:
@ -451,6 +451,22 @@ class Api {
|
||||
return note;
|
||||
}
|
||||
|
||||
if (request.method === 'PUT') {
|
||||
const note = await Note.load(id);
|
||||
|
||||
if (!note) throw new ErrorNotFound();
|
||||
|
||||
let updatedNote = await this.defaultAction_(BaseModel.TYPE_NOTE, request, id, link);
|
||||
|
||||
const requestNote = JSON.parse(request.body);
|
||||
if (requestNote.tags || requestNote.tags === '') {
|
||||
const tagTitles = requestNote.tags.split(',');
|
||||
await Tag.setNoteTagsByTitles(id, tagTitles);
|
||||
}
|
||||
|
||||
return updatedNote;
|
||||
}
|
||||
|
||||
return this.defaultAction_(BaseModel.TYPE_NOTE, request, id, link);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user