Skip to content

Commit

Permalink
Merge pull request #4102 from nextcloud/debug/mention
Browse files Browse the repository at this point in the history
fix: Add proper messages to mention response
  • Loading branch information
juliusknorr authored Dec 2, 2024
2 parents 78a57ac + 2f15d03 commit d759323
Showing 1 changed file with 3 additions and 3 deletions.
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);
}
}

0 comments on commit d759323

Please sign in to comment.