Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Add proper messages to mention response #4102

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions lib/Controller/MentionController.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public function mention(int $fileId, string $mention): DataResponse {
$userFolder = $this->rootFolder->getUserFolder($this->userId);
$file = $userFolder->getFirstNodeById($fileId);
if ($file === null) {
return new DataResponse([], Http::STATUS_NOT_FOUND);
return new DataResponse(['message' => 'File not found for current user'], Http::STATUS_NOT_FOUND);
}

// Reverse the array of users to pop off the first user later
Expand All @@ -52,7 +52,7 @@ public function mention(int $fileId, string $mention): DataResponse {
$userFolder = $this->rootFolder->getUserFolder($user->getUID());
$file = $userFolder->getFirstNodeById($fileId);
if ($file === null) {
return new DataResponse([], Http::STATUS_NOT_FOUND);
return new DataResponse(['message' => 'File not found for mentioned user'], Http::STATUS_NOT_FOUND);
}

$notification = $this->manager->createNotification();
Expand All @@ -70,6 +70,6 @@ public function mention(int $fileId, string $mention): DataResponse {
return new DataResponse([], Http::STATUS_OK);
}

return new DataResponse([], Http::STATUS_NOT_FOUND);
return new DataResponse(['message' => 'Notification already present'], Http::STATUS_NOT_FOUND);
}
}
Loading