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
232
Issues
232
List
Boards
Labels
Service Desk
Milestones
Merge Requests
36
Merge Requests
36
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
07b675ea
Commit
07b675ea
authored
5 hours ago
by
Marcelo Rivera
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(fix): a few issues in subscriptions/incoming
parent
5daa3183
epic/permissions-28
chore-refactor-permissions-export
1 merge request
!350
WIP: Epic/permissions 28
Pipeline
#86112352
passed with stages
in 9 minutes and 29 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
12 deletions
+16
-12
Controllers/api/v2/subscriptions/incoming.php
Controllers/api/v2/subscriptions/incoming.php
+14
-10
Core/Subscriptions/Requests/Manager.php
Core/Subscriptions/Requests/Manager.php
+2
-2
No files found.
Controllers/api/v2/subscriptions/incoming.php
View file @
07b675ea
...
...
@@ -5,22 +5,23 @@ namespace Minds\Controllers\api\v2\subscriptions;
use
Minds\Api\Factory
;
use
Minds\Core\Di\Di
;
use
Minds\Core\Session
;
use
Minds\Core\Subscriptions\Requests\Manager
;
use
Minds\Interfaces
;
/**
* Incoming subscritions
* Incoming subscri
p
tions
*/
class
incoming
implements
Interfaces\Api
{
public
function
get
(
$pages
)
:
bool
{
if
(
!
isset
(
$pages
[
0
]))
{
if
(
isset
(
$pages
[
0
]))
{
return
$this
->
getSingle
(
$pages
[
0
]);
}
else
{
return
$this
->
getList
(
$pages
[
0
]
);
return
$this
->
getList
();
}
}
/**
* Return a single request
* @param string $subscriberGuid
...
...
@@ -29,11 +30,12 @@ class incoming implements Interfaces\Api
private
function
getSingle
(
string
$subscriberGuid
)
:
bool
{
// Return a single request
/** @var Manager $manager */
$manager
=
Di
::
_
()
->
get
(
'Subscriptions\Requests\Manager'
);
// Construct URN on the fly
$urn
=
"urn:subscription-request:"
.
implode
(
'-'
,
[
Session
::
getLoggedInUserGuid
(),
$subscriberGuid
]);
$request
=
$manager
->
get
(
$urn
);
if
(
!
$request
||
$request
->
getPublisherGuid
()
!=
Session
::
getLoggedInUserGuid
())
{
...
...
@@ -55,10 +57,11 @@ class incoming implements Interfaces\Api
private
function
getList
()
:
bool
{
// Return a list of subscription requests
/** @var Manager $manager */
$manager
=
Di
::
_
()
->
get
(
'Subscriptions\Requests\Manager'
);
$requests
=
$manager
->
getIncomingList
(
Session
::
getLoggedInUserGuid
(),
[]);
return
Factory
::
response
([
'requests'
=>
Factory
::
exportable
(
$requests
),
'next'
=>
$requests
->
getPagingToken
(),
...
...
@@ -74,14 +77,15 @@ class incoming implements Interfaces\Api
public
function
put
(
$pages
)
{
// Accept / Deny
/** @var Manager $manager */
$manager
=
Di
::
_
()
->
get
(
'Subscriptions\Requests\Manager'
);
// Construct URN on the fly
$subscriberGuid
=
$pages
[
0
];
$urn
=
"urn:subscription-request:"
.
implode
(
'-'
,
[
Session
::
getLoggedInUserGuid
(),
$subscriberGuid
]);
$request
=
$manager
->
get
(
$urn
);
if
(
!
$request
||
$request
->
getPublisherGuid
()
!=
Session
::
getLoggedInUserGuid
())
{
return
Factory
::
response
([
'status'
=>
'error'
,
...
...
This diff is collapsed.
Click to expand it.
Core/Subscriptions/Requests/Manager.php
View file @
07b675ea
...
...
@@ -45,7 +45,7 @@ class Manager
'hydrate'
=>
true
,
],
$opts
);
$opts
[
'publisher_guid'
]
=
$user
_g
uid
;
$opts
[
'publisher_guid'
]
=
$user
G
uid
;
$response
=
$this
->
repository
->
getList
(
$opts
);
if
(
$opts
[
'hydrate'
])
{
...
...
@@ -109,7 +109,7 @@ class Manager
if
(
$existing
->
isDeclined
())
{
throw
new
SubscriptionRequestAlreadyCompletedException
();
}
$this
->
repository
->
delete
(
$subscriptionRequest
);
$this
->
notificationsDelegate
->
onAccept
(
$subscriptionRequest
);
...
...
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