mirror of
https://github.com/JanGross/quicknotes.git
synced 2025-12-01 07:37:18 +01:00
Fix unable to forget a shared note deleted by the owner. Issue #72
This commit is contained in:
@@ -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([]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user