Skip to content

Commit

Permalink
fix: get user by display name
Browse files Browse the repository at this point in the history
Signed-off-by: Elizabeth Danzberger <[email protected]>

[skip ci]
  • Loading branch information
elzody authored and backportbot[bot] committed Nov 6, 2024
1 parent ce5ff4d commit 5aacc7f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/Controller/MentionController.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
use OCP\AppFramework\Utility\ITimeFactory;
use OCP\Files\IRootFolder;
use OCP\IRequest;
use OCP\IUserManager;
use OCP\Notification\IManager;

class MentionController extends Controller {
Expand All @@ -25,6 +26,7 @@ public function __construct(
private IRootFolder $rootFolder,
private IManager $manager,
private ITimeFactory $timeFactory,
private IUserManager $userManager,
private ?string $userId,
) {
parent::__construct($appName, $request);
Expand All @@ -46,7 +48,7 @@ public function mention(int $fileId, string $mention): DataResponse {
}

$notification = $this->manager->createNotification();
$notification->setUser($mention)
$notification->setUser($user->getUID())
->setApp(Application::APPNAME)
->setSubject(Notifier::TYPE_MENTIONED, [
Notifier::SUBJECT_MENTIONED_SOURCE_USER => $this->userId,
Expand All @@ -58,7 +60,6 @@ public function mention(int $fileId, string $mention): DataResponse {
$notification->setDateTime(\DateTime::createFromImmutable($this->timeFactory->now()));
$this->manager->notify($notification);
return new DataResponse([], Http::STATUS_OK);

}

return new DataResponse([], Http::STATUS_NOT_FOUND);
Expand Down

0 comments on commit 5aacc7f

Please sign in to comment.