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
134
Issues
134
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
aa36b0eb
Commit
aa36b0eb
authored
5 hours ago
by
Mark Harding
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(feat): do not allow to participate in jury unless summoned
parent
22b46d5f
epic/ReportingAndModeration
1 merge request
!100
Epic/reporting and moderation
Pipeline
#61813319
canceled with stages
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
40 additions
and
2 deletions
+40
-2
jury.php
Controllers/api/v2/moderation/jury.php
+7
-1
Manager.php
Core/Reports/Jury/Manager.php
+26
-1
SummonsNotFoundException.php
Core/Reports/Summons/SummonsNotFoundException.php
+7
-0
No files found.
Controllers/api/v2/moderation/jury.php
View file @
aa36b0eb
...
...
@@ -12,6 +12,7 @@ use Minds\Interfaces;
use
Minds\Core\Di\Di
;
use
Minds\Core\Reports\Jury\Decision
;
use
Minds\Core\Reports\Jury\JuryClosedException
;
use
Minds\Core\Reports\Summons\SummonsNotFoundException
;
class
jury
implements
Interfaces\Api
{
...
...
@@ -19,7 +20,7 @@ class jury implements Interfaces\Api
{
$juryType
=
$pages
[
0
]
??
'appeal'
;
if
(
$juryType
!==
'appeal'
&&
!
Core\Session
::
isAdmin
())
{
if
(
$juryType
===
'appeal'
||
!
Core\Session
::
isAdmin
())
{
exit
;
}
...
...
@@ -98,6 +99,11 @@ class jury implements Interfaces\Api
'status'
=>
'error'
,
'message'
=>
'The jury has already closed'
]);
}
catch
(
SummonsNotFoundException
$e
)
{
return
Factory
::
response
([
'status'
=>
'error'
,
'message'
=>
'A summons could not be found'
]);
}
return
Factory
::
response
([]);
...
...
This diff is collapsed.
Click to expand it.
Core/Reports/Jury/Manager.php
View file @
aa36b0eb
...
...
@@ -14,6 +14,8 @@ use Minds\Entities\NormalizedEntity;
use
Minds\Common\Repository\Response
;
use
Minds\Common\Urn
;
use
Minds\Core\Entities\Resolver
as
EntitiesResolver
;
use
Minds\Core\Reports\Summons\SummonsNotFoundException
;
use
Minds\Core\Reports\Summons\Summon
as
SummonsEntity
;
class
Manager
{
...
...
@@ -27,6 +29,9 @@ class Manager
/** @var VerdictManager $verdictManager */
private
$verdictManager
;
/** @var SummonsManager $summonsManager */
private
$summonsManager
;
/** @var string $juryType */
private
$juryType
;
...
...
@@ -36,12 +41,14 @@ class Manager
public
function
__construct
(
$repository
=
null
,
$entitiesResolver
=
null
,
$verdictManager
=
null
$verdictManager
=
null
,
$summonsManager
=
null
)
{
$this
->
repository
=
$repository
?:
new
Repository
;
$this
->
entitiesResolver
=
$entitiesResolver
?:
new
EntitiesResolver
;
$this
->
verdictManager
=
$verdictManager
?:
Di
::
_
()
->
get
(
'Moderation\Verdict\Manager'
);
$this
->
summonsManager
=
$summonsManager
?:
Di
::
_
()
->
get
(
'Moderation\Summons\Manager'
);
}
/**
...
...
@@ -135,6 +142,10 @@ class Manager
throw
new
JuryClosedException
();
}
if
(
$decision
->
isAppeal
()
&&
!
$this
->
hasSummons
(
$decision
))
{
throw
new
SummonsNotFoundException
();
}
$success
=
$this
->
repository
->
add
(
$decision
);
if
(
$decision
->
isAppeal
())
{
...
...
@@ -152,4 +163,18 @@ class Manager
return
$success
;
}
/**
* Return if a summons exists
* @param Decision $decision
* @return boolean
*/
private
function
hasSummons
(
Decision
$decision
)
{
$summons
=
new
SummonsEntity
();
$summons
->
setReportUrn
(
$decision
->
getReport
()
->
getUrn
())
->
setJurorGuid
(
$decision
->
getJurorGuid
())
->
setJuryType
(
'appeal_jury'
);
return
$this
->
summonsManager
->
isSummoned
(
$summons
);
}
}
This diff is collapsed.
Click to expand it.
Core/Reports/Summons/SummonsNotFoundException.php
0 → 100644
View file @
aa36b0eb
<?php
namespace
Minds\Core\Reports\Summons
;
class
SummonsNotFoundException
extends
\Exception
{
protected
$message
=
"A summons could not be found"
;
}
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