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
221
Issues
221
List
Boards
Labels
Service Desk
Milestones
Merge Requests
35
Merge Requests
35
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
Compare Revisions
01c9ba9fe661774118d935288bd972ec5bf414db...b67c48fc6c7650156c3bdf845ae1332b5137227c
Source
b67c48fc6c7650156c3bdf845ae1332b5137227c
Select Git revision
...
Target
01c9ba9fe661774118d935288bd972ec5bf414db
Select Git revision
Compare
Commits (2)
(refactor): Return both channel and current user on main pro endpoint
· 884960b7
Emiliano Balbuena
authored
16 hours ago
884960b7
(cs): code lint
· b67c48fc
Emiliano Balbuena
authored
16 hours ago
b67c48fc
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
9 deletions
+29
-9
channel.php
Controllers/api/v2/pro/channel.php
+25
-4
Manager.php
Core/Pro/Manager.php
+4
-5
No files found.
Controllers/api/v2/pro/channel.php
View file @
b67c48fc
...
...
@@ -8,7 +8,9 @@ namespace Minds\Controllers\api\v2\pro;
use
Exception
;
use
Minds\Core\Di\Di
;
use
Minds\Core\Pro\Channel\Manager
;
use
Minds\Core\Pro\Channel\Manager
as
ChannelManager
;
use
Minds\Core\Pro\Manager
;
use
Minds\Core\Session
;
use
Minds\Entities\User
;
use
Minds\Interfaces
;
use
Minds\Api\Factory
;
...
...
@@ -23,14 +25,33 @@ class channel implements Interfaces\Api
*/
public
function
get
(
$pages
)
{
$currentUser
=
Session
::
getLoggedinUser
();
$channel
=
new
User
(
$pages
[
0
]);
$channel
->
fullExport
=
true
;
//get counts
$channel
->
exportCounts
=
true
;
/** @var Manager $manager */
$manager
=
Di
::
_
()
->
get
(
'Pro\Channel\Manager'
);
$manager
->
setUser
(
new
User
(
$pages
[
0
]));
$manager
=
Di
::
_
()
->
get
(
'Pro\Manager'
);
$manager
->
setUser
(
$channel
);
/** @var ChannelManager $manager */
$channelManager
=
Di
::
_
()
->
get
(
'Pro\Channel\Manager'
);
$channelManager
->
setUser
(
$channel
);
switch
(
$pages
[
1
]
??
''
)
{
case
'content'
:
return
Factory
::
response
([
'content'
=>
$manager
->
getAllCategoriesContent
(),
'content'
=>
$channelManager
->
getAllCategoriesContent
(),
]);
default
:
$exportedChannel
=
$channel
->
export
();
$exportedChannel
[
'pro_settings'
]
=
$manager
->
get
();
return
Factory
::
response
([
'channel'
=>
$exportedChannel
,
'me'
=>
$currentUser
?
$currentUser
->
export
()
:
null
,
]);
}
}
...
...
This diff is collapsed.
Click to expand it.
Core/Pro/Manager.php
View file @
b67c48fc
...
...
@@ -50,8 +50,7 @@ class Manager
$initializeSettingsDelegate
=
null
,
$hydrateSettingsDelegate
=
null
,
$entitiesBuilder
=
null
)
{
)
{
$this
->
repository
=
$repository
?:
new
Repository
();
$this
->
saveAction
=
$saveAction
?:
new
Save
();
$this
->
initializeSettingsDelegate
=
$initializeSettingsDelegate
?:
new
Delegates\InitializeSettingsDelegate
();
...
...
@@ -245,7 +244,7 @@ class Manager
}
if
(
isset
(
$values
[
'tile_ratio'
]))
{
if
(
!
in_array
(
$values
[
'tile_ratio'
],
Settings
::
TILE_RATIOS
))
{
if
(
!
in_array
(
$values
[
'tile_ratio'
],
Settings
::
TILE_RATIOS
,
true
))
{
throw
new
\Exception
(
'Invalid tile ratio'
);
}
...
...
@@ -257,7 +256,7 @@ class Manager
$image
=
$this
->
entitiesBuilder
->
single
(
$values
[
'logo_guid'
]);
// if the image doesn't exist or the guid doesn't correspond to an image
if
(
!
$image
||
(
$image
->
type
!==
'object'
||
$image
->
subtype
!==
'image'
))
{
if
(
!
$image
||
(
$image
->
type
!==
'object'
||
$image
->
subtype
!==
'image'
))
{
throw
new
\Exception
(
'logo_guid must be a valid image guid'
);
}
...
...
@@ -305,7 +304,7 @@ class Manager
}
if
(
isset
(
$values
[
'scheme'
]))
{
if
(
!
in_array
(
$values
[
'scheme'
],
Settings
::
COLOR_SCHEMES
))
{
if
(
!
in_array
(
$values
[
'scheme'
],
Settings
::
COLOR_SCHEMES
,
true
))
{
throw
new
\Exception
(
'Invalid tile ratio'
);
}
$settings
...
...
This diff is collapsed.
Click to expand it.