| @@ 800-828 (lines=29) @@ | ||
| 797 | * @param DeprecatedCircle $circle |
|
| 798 | * @param DeprecatedMember $member |
|
| 799 | */ |
|
| 800 | private function notificationOnInvitation(DeprecatedCircle $circle, DeprecatedMember $member) { |
|
| 801 | $this->deleteNotification('membership_request', $member->getMemberId()); |
|
| 802 | if ($member->getType() !== DeprecatedMember::TYPE_USER) { |
|
| 803 | return; |
|
| 804 | } |
|
| 805 | ||
| 806 | $notification = $this->createNotification( |
|
| 807 | $circle, $circle->getViewer(), $member->getUserId(), 'invitation', 'membership', |
|
| 808 | $member->getMemberId() |
|
| 809 | ); |
|
| 810 | ||
| 811 | $declineAction = $notification->createAction(); |
|
| 812 | $declineUrl = |
|
| 813 | $this->urlGenerator->linkToRoute('circles.Circles.leave', ['uniqueId' => $circle->getUniqueId()]); |
|
| 814 | ||
| 815 | $declineAction->setLabel('refuse') |
|
| 816 | ->setLink($this->urlGenerator->getAbsoluteURL($declineUrl), 'GET'); |
|
| 817 | $notification->addAction($declineAction); |
|
| 818 | ||
| 819 | $acceptAction = $notification->createAction(); |
|
| 820 | $acceptUrl = |
|
| 821 | $this->urlGenerator->linkToRoute('circles.Circles.join', ['uniqueId' => $circle->getUniqueId()]); |
|
| 822 | ||
| 823 | $acceptAction->setLabel('accept') |
|
| 824 | ->setLink($this->urlGenerator->getAbsoluteURL($acceptUrl), 'GET'); |
|
| 825 | $notification->addAction($acceptAction); |
|
| 826 | ||
| 827 | $this->notificationManager->notify($notification); |
|
| 828 | } |
|
| 829 | ||
| 830 | /** |
|
| 831 | * @param DeprecatedCircle $circle |
|
| @@ 98-123 (lines=26) @@ | ||
| 95 | /** |
|
| 96 | * @param Member $member |
|
| 97 | */ |
|
| 98 | public function notificationInvited(Member $member): void { |
|
| 99 | if ($member->getUserType() !== Member::TYPE_USER || !$member->isLocal()) { |
|
| 100 | return; |
|
| 101 | } |
|
| 102 | ||
| 103 | $this->deleteNotification('member', $member->getId()); |
|
| 104 | $notification = $this->createMemberNotification( |
|
| 105 | $member->getUserId(), |
|
| 106 | $member->getId(), |
|
| 107 | 'invitation' |
|
| 108 | ); |
|
| 109 | ||
| 110 | $declineAction = $notification->createAction(); |
|
| 111 | $declineUrl = $this->linkToOCS('circles.Local.circleLeave', ['circleId' => $member->getCircleId()]); |
|
| 112 | $declineAction->setLabel('refuse') |
|
| 113 | ->setLink($this->urlGenerator->getAbsoluteURL($declineUrl), 'PUT'); |
|
| 114 | $notification->addAction($declineAction); |
|
| 115 | ||
| 116 | $acceptAction = $notification->createAction(); |
|
| 117 | $acceptUrl = $this->linkToOCS('circles.Local.circleJoin', ['circleId' => $member->getCircleId()]); |
|
| 118 | $acceptAction->setLabel('accept') |
|
| 119 | ->setLink($this->urlGenerator->getAbsoluteURL($acceptUrl), 'PUT'); |
|
| 120 | $notification->addAction($acceptAction); |
|
| 121 | ||
| 122 | $this->notificationManager->notify($notification); |
|
| 123 | } |
|
| 124 | ||
| 125 | ||
| 126 | /** |
|