|
@@ 126-133 (lines=8) @@
|
| 123 |
|
$note->setMtime(time()); |
| 124 |
|
$note->setDeleted(0); |
| 125 |
|
|
| 126 |
|
if(!empty($notebook_id)){ |
| 127 |
|
$notebook = $this->notebookService->find($notebook_id); |
| 128 |
|
if($notebook instanceof Notebook) { |
| 129 |
|
$note->setNotebook($notebook->getId()); |
| 130 |
|
} else { |
| 131 |
|
return new JSONResponse(['error' => 'Notebook not found']); |
| 132 |
|
} |
| 133 |
|
} |
| 134 |
|
|
| 135 |
|
$result = $this->noteService->create($note)->jsonSerialize(); |
| 136 |
|
\OC_Hook::emit('OCA\NextNote', 'post_create_note', ['note' => $note]); |
|
@@ 161-168 (lines=8) @@
|
| 158 |
|
if (!$this->shareBackend->checkPermissions(Constants::PERMISSION_UPDATE, $note)) { |
| 159 |
|
return new UnauthorizedJSONResponse(); |
| 160 |
|
} |
| 161 |
|
if(!empty($notebook_id)){ |
| 162 |
|
$notebook = $this->notebookService->find($notebook_id); |
| 163 |
|
if($notebook instanceof Notebook) { |
| 164 |
|
$note->setNotebook($notebook->getId()); |
| 165 |
|
} else { |
| 166 |
|
return new JSONResponse(['error' => 'Notebook not found']); |
| 167 |
|
} |
| 168 |
|
} |
| 169 |
|
$note->setName($title); |
| 170 |
|
$note->setNote($content); |
| 171 |
|
$note->setDeleted($deleted); |