diff options
author | dartcafe <github@dartcafe.de> | 2020-11-13 19:28:06 +0300 |
---|---|---|
committer | dartcafe <github@dartcafe.de> | 2020-11-19 10:20:51 +0300 |
commit | d67353002d36861c1719d5f0be51461ff5043f8d (patch) | |
tree | 371ee816b2deac55fec930070a13599916d40998 /lib/Controller/ShareController.php | |
parent | fcbecea28918bfdad9602217791263bbd35fbb53 (diff) |
invitation via notifications
Diffstat (limited to 'lib/Controller/ShareController.php')
-rw-r--r-- | lib/Controller/ShareController.php | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/lib/Controller/ShareController.php b/lib/Controller/ShareController.php index 6e39beda..a26f95ff 100644 --- a/lib/Controller/ShareController.php +++ b/lib/Controller/ShareController.php @@ -32,6 +32,7 @@ use OCP\AppFramework\Http\DataResponse; use OCA\Polls\DB\Share; use OCA\Polls\Service\MailService; +use OCA\Polls\Service\NotificationService; use OCA\Polls\Service\ShareService; use OCA\Polls\Service\SystemService; use OCA\Polls\Model\Circle; @@ -49,6 +50,9 @@ class ShareController extends Controller { /** @var SystemService */ private $systemService; + /** @var NotificationService */ + private $notificationService; + /** * ShareController constructor. * @param string $appName @@ -62,12 +66,14 @@ class ShareController extends Controller { IRequest $request, MailService $mailService, ShareService $shareService, - SystemService $systemService + SystemService $systemService, + NotificationService $notificationService ) { parent::__construct($appName, $request); $this->mailService = $mailService; $this->shareService = $shareService; $this->systemService = $systemService; + $this->notificationService = $notificationService; } /** @@ -162,8 +168,13 @@ class ShareController extends Controller { */ public function sendInvitation($token) { return $this->response(function () use ($token) { - $sentResult = $this->mailService->sendInvitationMail($token); $share = $this->shareService->get($token); + if ($share->getType() === Share::TYPE_USER) { + $this->notificationService->sendInvitation($share->getPollId(), $share->getUserId()); + $sentResult = ['sentMails' => [$share->getuserId()]]; + } else { + $sentResult = $this->mailService->sendInvitationMail($token); + } return [ 'share' => $share, 'sentResult' => $sentResult |