. * */ namespace OCA\Talk\Controller; use OCA\Talk\GuestManager; use OCA\Talk\Participant; use OCP\AppFramework\Http; use OCP\AppFramework\Http\DataResponse; use OCP\IRequest; class GuestController extends AEnvironmentAwareController { private GuestManager $guestManager; public function __construct(string $appName, IRequest $request, GuestManager $guestManager) { parent::__construct($appName, $request); $this->guestManager = $guestManager; } /** * @PublicPage * @RequireParticipant * * @param string $displayName * @return DataResponse */ public function setDisplayName(string $displayName): DataResponse { $participant = $this->getParticipant(); if (!$participant instanceof Participant) { return new DataResponse([], Http::STATUS_NOT_FOUND); } if (!$participant->isGuest()) { return new DataResponse([], Http::STATUS_FORBIDDEN); } $this->guestManager->updateName($this->getRoom(), $participant, $displayName); return new DataResponse(); } }