Skip to content
Next
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Switch to GitLab Next
Sign in / Register
Toggle navigation
Minds Backend - Engine
Project
Project
Details
Activity
Releases
Cycle Analytics
Insights
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Locked Files
Issues
211
Issues
211
List
Boards
Labels
Service Desk
Milestones
Merge Requests
33
Merge Requests
33
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Security & Compliance
Security & Compliance
Dependency List
Packages
Packages
List
Container Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Minds
Minds Backend - Engine
Commits
d36fc658
Commit
d36fc658
authored
37 minutes ago
by
Mark Harding
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(feat): send notifications when subscription requests are made
parent
51f551dd
epic/permissions-sub-reqs
1 merge request
!327
Subscription Requests - #604
Pipeline
#82751545
passed with stages
in 13 minutes and 12 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
3 deletions
+31
-3
NotificationsDelegate.php
...ubscriptions/Requests/Delegates/NotificationsDelegate.php
+31
-3
No files found.
Core/Subscriptions/Requests/Delegates/NotificationsDelegate.php
View file @
d36fc658
<?php
namespace
Minds\Core\Subscriptions\Requests\Delegates
;
use
Minds\Core\Di\Di
;
use
Minds\Core\Events\EventsDispatcher
;
use
Minds\Core\Subscriptions\Requests\SubscriptionRequest
;
class
NotificationsDelegate
{
/** @var EventsDispatcher */
private
$eventsDispatcher
;
public
function
__construct
(
$eventsDispatcher
=
null
)
{
$this
->
eventsDispatcher
=
$eventsDispatcher
?:
Di
::
_
()
->
get
(
'EventsDispatcher'
);
}
/**
* Called when subscription request is made
* @param SubscriptionRequest $subscriptionRequest
...
...
@@ -12,7 +22,13 @@ class NotificationsDelegate
*/
public
function
onAdd
(
SubscriptionRequest
$subscriptionRequest
)
:
void
{
// TODO
$this
->
eventsDispatcher
->
trigger
(
'notification'
,
'all'
,
[
'to'
=>
[
$subscriptionRequest
->
getPublisherGuid
()
],
'entity'
=>
$subscriptionRequest
->
getSubscriberGuid
(),
'notification_view'
=>
'subscription_request_received'
,
'from'
=>
$subscriptionRequest
->
getSubscriberGuid
(),
'params'
=>
[],
]);
}
/**
...
...
@@ -22,7 +38,13 @@ class NotificationsDelegate
*/
public
function
onAccept
(
SubscriptionRequest
$subscriptionRequest
)
:
void
{
// TODO
$this
->
eventsDispatcher
->
trigger
(
'notification'
,
'all'
,
[
'to'
=>
[
$subscription
->
getSubscriberGuid
()
],
'entity'
=>
$subscription
->
getPublisherGuid
(),
'notification_view'
=>
'subscription_request_accepted'
,
'from'
=>
$subscription
->
getPublisherGuid
(),
'params'
=>
[],
]);
}
/**
...
...
@@ -32,6 +54,12 @@ class NotificationsDelegate
*/
public
function
onDecline
(
SubscriptionRequest
$subscriptionRequest
)
:
void
{
// TODO
$this
->
eventsDispatcher
->
trigger
(
'notification'
,
'all'
,
[
'to'
=>
[
$subscription
->
getSubscriberGuid
()
],
'entity'
=>
$subscription
->
getPublisherGuid
(),
'notification_view'
=>
'subscription_request_declined'
,
'from'
=>
$subscription
->
getPublisherGuid
(),
'params'
=>
[],
]);
}
}
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment