diff --git a/appinfo/routes.php b/appinfo/routes.php index 5a1fbdb..a3da736 100644 --- a/appinfo/routes.php +++ b/appinfo/routes.php @@ -19,7 +19,7 @@ return ['resources' => ], // Share [ - 'name' => 'share#destroy', + 'name' => 'share#forget', 'url' => '/share/{noteId}', 'verb' => 'DELETE' ], diff --git a/js/script.js b/js/script.js index ce72a4b..c038ae5 100644 --- a/js/script.js +++ b/js/script.js @@ -387,7 +387,7 @@ View.prototype = { self._notes.forgetShare(note).done(function () { if (self._notes.length() > 0) { self._isotope.remove(gridnote.parent()) - selg._isotope.layout(); + self._isotope.layout(); self.showAll(); self.renderNavigation(); } else { diff --git a/lib/Controller/ShareController.php b/lib/Controller/ShareController.php index a7d0455..7ec50c8 100644 --- a/lib/Controller/ShareController.php +++ b/lib/Controller/ShareController.php @@ -54,12 +54,9 @@ class ShareController extends Controller { * * @param int $noteId */ - public function destroy(int $noteId): JSONResponse { - if ($this->noteShareMapper->forgetShareByNoteIdAndSharedUser($noteId, $this->userId)) { - return new JSONResponse([], Http::STATUS_OK); - } else { - return new JSONResponse([], Http::STATUS_NOT_FOUND); - } + public function forget(int $noteId): JSONResponse { + $this->noteShareMapper->forgetShareByNoteIdAndSharedUser($noteId, $this->userId); + return new JSONResponse([]); } } diff --git a/lib/Dashboard/NotesWidget.php b/lib/Dashboard/NotesWidget.php index b253e6a..3e0e9da 100644 --- a/lib/Dashboard/NotesWidget.php +++ b/lib/Dashboard/NotesWidget.php @@ -10,8 +10,8 @@ use OCP\IURLGenerator; class NotesWidget implements IWidget { - private IURLGenerator $url; - private IL10N $l10n; + private $url; + private $l10n; public function __construct(IURLGenerator $url, IL10N $l10n) diff --git a/lib/Db/NoteShareMapper.php b/lib/Db/NoteShareMapper.php index 0bc3dd3..e147134 100644 --- a/lib/Db/NoteShareMapper.php +++ b/lib/Db/NoteShareMapper.php @@ -73,7 +73,7 @@ class NoteShareMapper extends QBMapper { ->execute(); } - public function forgetShareByNoteIdAndSharedUser(int $noteId, string $userId) { + public function forgetShareByNoteIdAndSharedUser(int $noteId, string $userId): bool { try { $noteShare = $this->findSharesByNoteIsAndSharedUser($noteId, $userId); } catch (DoesNotExistException $e) { @@ -86,7 +86,7 @@ class NoteShareMapper extends QBMapper { /** * @return bool */ - public function existsByNoteAndSharedUser(int $noteId, string $userId) { + public function existsByNoteAndSharedUser(int $noteId, string $userId): bool { try { $this->findSharesByNoteIsAndSharedUser($noteId, $userId); } catch (DoesNotExistException $e) {