Skip to content
Next
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Switch to GitLab Next
Sign in / Register
Toggle navigation
Minds Backend - Engine
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Locked Files
Issues
139
Issues
139
List
Boards
Labels
Service Desk
Milestones
Merge Requests
28
Merge Requests
28
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Packages
Packages
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
e40d62d3
Commit
e40d62d3
authored
6 hours ago
by
Mark Harding
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(chore): spam check comments
parent
85de3a3c
master
No related merge requests found
Pipeline
#63469182
passed with stages
in 8 minutes and 17 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
3 deletions
+17
-3
Manager.php
Core/Comments/Manager.php
+8
-1
ManagerSpec.php
Spec/Core/Comments/ManagerSpec.php
+9
-2
No files found.
Core/Comments/Manager.php
View file @
e40d62d3
...
...
@@ -43,6 +43,9 @@ class Manager
/** @var EntitiesBuilder */
protected
$entitiesBuilder
;
/** @var Security\Spam */
protected
$spam
;
/**
* Manager constructor.
* @param Repository|null $repository
...
...
@@ -55,7 +58,8 @@ class Manager
$threadNotifications
=
null
,
$createEventDispatcher
=
null
,
$countCache
=
null
,
$entitiesBuilder
=
null
$entitiesBuilder
=
null
,
$spam
=
null
)
{
$this
->
repository
=
$repository
?:
new
Repository
();
...
...
@@ -66,6 +70,7 @@ class Manager
$this
->
createEventDispatcher
=
$createEventDispatcher
?:
new
Delegates\CreateEventDispatcher
();
$this
->
countCache
=
$countCache
?:
new
Delegates\CountCache
();
$this
->
entitiesBuilder
=
$entitiesBuilder
?:
Di
::
_
()
->
get
(
'EntitiesBuilder'
);
$this
->
spam
=
$spam
?:
Di
::
_
()
->
get
(
'Security\Spam'
);
}
public
function
get
(
$entity_guid
,
$parent_path
,
$guid
)
...
...
@@ -130,6 +135,8 @@ class Manager
throw
new
\Exception
();
}
$this
->
spam
->
check
(
$comment
);
if
(
!
$comment
->
getOwnerGuid
()
||
!
$this
->
acl
->
interact
(
$entity
,
$owner
)
...
...
This diff is collapsed.
Click to expand it.
Spec/Core/Comments/ManagerSpec.php
View file @
e40d62d3
...
...
@@ -12,6 +12,7 @@ use Minds\Core\Comments\Repository;
use
Minds\Core\EntitiesBuilder
;
use
Minds\Core\Luid
;
use
Minds\Core\Security\ACL
;
use
Minds\Core\Security\Spam
;
use
Minds\Entities\Entity
;
use
Minds\Entities\User
;
use
Minds\Exceptions\BlockedUserException
;
...
...
@@ -44,6 +45,9 @@ class ManagerSpec extends ObjectBehavior
/** @var EntitiesBuilder */
protected
$entitiesBuilder
;
/** @var Security\Spam */
protected
$spam
;
function
let
(
Repository
$repository
,
LegacyRepository
$legacyRepository
,
...
...
@@ -52,7 +56,8 @@ class ManagerSpec extends ObjectBehavior
ThreadNotifications
$threadNotifications
,
CreateEventDispatcher
$createEventDispatcher
,
CountCache
$countCache
,
EntitiesBuilder
$entitiesBuilder
EntitiesBuilder
$entitiesBuilder
,
Spam
$spam
)
{
$this
->
beConstructedWith
(
$repository
,
...
...
@@ -62,7 +67,8 @@ class ManagerSpec extends ObjectBehavior
$threadNotifications
,
$createEventDispatcher
,
$countCache
,
$entitiesBuilder
$entitiesBuilder
,
$spam
);
$this
->
repository
=
$repository
;
...
...
@@ -73,6 +79,7 @@ class ManagerSpec extends ObjectBehavior
$this
->
createEventDispatcher
=
$createEventDispatcher
;
$this
->
countCache
=
$countCache
;
$this
->
entitiesBuilder
=
$entitiesBuilder
;
$this
->
spam
=
$spam
;
}
function
it_is_initializable
()
...
...
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