mirror of
https://github.com/JanGross/quicknotes.git
synced 2025-11-30 23:37:16 +01:00
Fix unable to forget a shared note deleted by the owner. Issue #72
This commit is contained in:
@@ -19,7 +19,7 @@ return ['resources' =>
|
|||||||
],
|
],
|
||||||
// Share
|
// Share
|
||||||
[
|
[
|
||||||
'name' => 'share#destroy',
|
'name' => 'share#forget',
|
||||||
'url' => '/share/{noteId}',
|
'url' => '/share/{noteId}',
|
||||||
'verb' => 'DELETE'
|
'verb' => 'DELETE'
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -387,7 +387,7 @@ View.prototype = {
|
|||||||
self._notes.forgetShare(note).done(function () {
|
self._notes.forgetShare(note).done(function () {
|
||||||
if (self._notes.length() > 0) {
|
if (self._notes.length() > 0) {
|
||||||
self._isotope.remove(gridnote.parent())
|
self._isotope.remove(gridnote.parent())
|
||||||
selg._isotope.layout();
|
self._isotope.layout();
|
||||||
self.showAll();
|
self.showAll();
|
||||||
self.renderNavigation();
|
self.renderNavigation();
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -54,12 +54,9 @@ class ShareController extends Controller {
|
|||||||
*
|
*
|
||||||
* @param int $noteId
|
* @param int $noteId
|
||||||
*/
|
*/
|
||||||
public function destroy(int $noteId): JSONResponse {
|
public function forget(int $noteId): JSONResponse {
|
||||||
if ($this->noteShareMapper->forgetShareByNoteIdAndSharedUser($noteId, $this->userId)) {
|
$this->noteShareMapper->forgetShareByNoteIdAndSharedUser($noteId, $this->userId);
|
||||||
return new JSONResponse([], Http::STATUS_OK);
|
return new JSONResponse([]);
|
||||||
} else {
|
|
||||||
return new JSONResponse([], Http::STATUS_NOT_FOUND);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,8 +10,8 @@ use OCP\IURLGenerator;
|
|||||||
|
|
||||||
class NotesWidget implements IWidget {
|
class NotesWidget implements IWidget {
|
||||||
|
|
||||||
private IURLGenerator $url;
|
private $url;
|
||||||
private IL10N $l10n;
|
private $l10n;
|
||||||
|
|
||||||
public function __construct(IURLGenerator $url,
|
public function __construct(IURLGenerator $url,
|
||||||
IL10N $l10n)
|
IL10N $l10n)
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ class NoteShareMapper extends QBMapper {
|
|||||||
->execute();
|
->execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function forgetShareByNoteIdAndSharedUser(int $noteId, string $userId) {
|
public function forgetShareByNoteIdAndSharedUser(int $noteId, string $userId): bool {
|
||||||
try {
|
try {
|
||||||
$noteShare = $this->findSharesByNoteIsAndSharedUser($noteId, $userId);
|
$noteShare = $this->findSharesByNoteIsAndSharedUser($noteId, $userId);
|
||||||
} catch (DoesNotExistException $e) {
|
} catch (DoesNotExistException $e) {
|
||||||
@@ -86,7 +86,7 @@ class NoteShareMapper extends QBMapper {
|
|||||||
/**
|
/**
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function existsByNoteAndSharedUser(int $noteId, string $userId) {
|
public function existsByNoteAndSharedUser(int $noteId, string $userId): bool {
|
||||||
try {
|
try {
|
||||||
$this->findSharesByNoteIsAndSharedUser($noteId, $userId);
|
$this->findSharesByNoteIsAndSharedUser($noteId, $userId);
|
||||||
} catch (DoesNotExistException $e) {
|
} catch (DoesNotExistException $e) {
|
||||||
|
|||||||
Reference in New Issue
Block a user