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
241
Issues
241
List
Boards
Labels
Service Desk
Milestones
Merge Requests
31
Merge Requests
31
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
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
e4d27bc1
Commit
e4d27bc1
authored
3 hours ago
by
Brian Hatchet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MR review changes
parent
50bbd9bd
1 merge request
!295
Feat/closed channels 602
Pipeline
#78437828
passed with stages
in 12 minutes and 2 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
10 deletions
+11
-10
ChannelMode.php
Common/ChannelMode.php
+2
-2
User.php
Entities/User.php
+2
-4
UserSpec.php
Spec/Entities/UserSpec.php
+7
-4
No files found.
Common/ChannelMode.php
View file @
e4d27bc1
...
...
@@ -9,12 +9,12 @@ abstract class ChannelMode
const
MODERATED
=
1
;
const
CLOSED
=
2
;
final
public
static
function
toArray
()
final
public
static
function
toArray
()
:
array
{
return
(
new
ReflectionClass
(
static
::
class
))
->
getConstants
();
}
final
public
static
function
isValid
(
$value
)
final
public
static
function
isValid
(
$value
)
:
bool
{
return
in_array
(
$value
,
static
::
toArray
());
}
...
...
This diff is collapsed.
Click to expand it.
Entities/User.php
View file @
e4d27bc1
...
...
@@ -3,6 +3,7 @@ namespace Minds\Entities;
use
Minds\Core
;
use
Minds\Helpers
;
use
Minds\Common\ChannelMode
;
/**
* User Entity
...
...
@@ -10,9 +11,6 @@ use Minds\Helpers;
*/
class
User
extends
\ElggUser
{
public
const
MODE_OPEN
=
0
;
public
const
MODE_MODERATED
=
1
;
public
const
MODE_CLOSED
=
2
;
public
$fullExport
=
true
;
public
$exportCounts
=
false
;
...
...
@@ -55,7 +53,7 @@ class User extends \ElggUser
$this
->
attributes
[
'canary'
]
=
0
;
$this
->
attributes
[
'onchain_booster'
]
=
null
;
$this
->
attributes
[
'toaster_notifications'
]
=
1
;
$this
->
attributes
[
'mode'
]
=
User
::
MODE_
OPEN
;
$this
->
attributes
[
'mode'
]
=
ChannelMode
::
OPEN
;
parent
::
initializeAttributes
();
}
...
...
This diff is collapsed.
Click to expand it.
Spec/Entities/UserSpec.php
View file @
e4d27bc1
...
...
@@ -6,6 +6,7 @@ use Minds\Entities\User;
use
Minds\Core\Di\Di
;
use
PhpSpec\ObjectBehavior
;
use
Prophecy\Argument
;
use
Minds\Common\ChannelMode
;
class
UserSpec
extends
ObjectBehavior
{
...
...
@@ -51,16 +52,18 @@ class UserSpec extends ObjectBehavior
}
function
it_should_have_a_default_mode_of_open
()
{
$this
->
getMode
()
->
shouldEqual
(
User
::
MODE_
OPEN
);
$this
->
getMode
()
->
shouldEqual
(
ChannelMode
::
OPEN
);
}
function
it_should_assign_channel_modes
()
{
$this
->
setMode
(
User
::
MODE_CLOSED
);
$this
->
getMode
()
->
shouldEqual
(
User
::
MODE_CLOSED
);
$this
->
setMode
(
ChannelMode
::
CLOSED
);
$this
->
getMode
()
->
shouldEqual
(
ChannelMode
::
CLOSED
);
$this
->
setMode
(
ChannelMode
::
MODERATED
);
$this
->
getMode
()
->
shouldEqual
(
ChannelMode
::
MODERATED
);
}
function
it_should_export_values
()
{
$export
=
$this
->
export
()
->
getWrappedObject
();
expect
(
$export
[
'mode'
])
->
shouldEqual
(
User
::
MODE_
OPEN
);
expect
(
$export
[
'mode'
])
->
shouldEqual
(
ChannelMode
::
OPEN
);
}
}
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