|
@@ 135-142 (lines=8) @@
|
| 132 |
|
$note->setMtime(time()); |
| 133 |
|
$note->setDeleted(0); |
| 134 |
|
|
| 135 |
|
if(!empty($notebook_id)){ |
| 136 |
|
$notebook = $this->notebookService->find($notebook_id); |
| 137 |
|
if($notebook instanceof Notebook) { |
| 138 |
|
$note->setNotebook($notebook->getId()); |
| 139 |
|
} else { |
| 140 |
|
return new JSONResponse(['error' => 'Notebook not found']); |
| 141 |
|
} |
| 142 |
|
} |
| 143 |
|
|
| 144 |
|
$result = $this->noteService->create($note)->jsonSerialize(); |
| 145 |
|
\OC_Hook::emit('OCA\NextNote', 'post_create_note', ['note' => $note]); |
|
@@ 170-177 (lines=8) @@
|
| 167 |
|
if (!$this->shareBackend->checkPermissions(Constants::PERMISSION_UPDATE, $note)) { |
| 168 |
|
return new UnauthorizedJSONResponse(); |
| 169 |
|
} |
| 170 |
|
if(!empty($notebook_id)){ |
| 171 |
|
$notebook = $this->notebookService->find($notebook_id); |
| 172 |
|
if($notebook instanceof Notebook) { |
| 173 |
|
$note->setNotebook($notebook->getId()); |
| 174 |
|
} else { |
| 175 |
|
return new JSONResponse(['error' => 'Notebook not found']); |
| 176 |
|
} |
| 177 |
|
} |
| 178 |
|
$note->setName($title); |
| 179 |
|
$note->setNote($content); |
| 180 |
|
$note->setDeleted($deleted); |