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
131
Issues
131
List
Boards
Labels
Service Desk
Milestones
Merge Requests
27
Merge Requests
27
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
Compare Revisions
2c6cbbccad72e01d1964cf45f66f3ec440d26e20...cf8726fadc40de509005fea8372043251829fb68
Source
cf8726fadc40de509005fea8372043251829fb68
Select Git revision
...
Target
2c6cbbccad72e01d1964cf45f66f3ec440d26e20
Select Git revision
Compare
Commits (3)
(fix): do not allow votes in jury if the jury is closed
· 7f97f49c
Mark Harding
authored
37 minutes ago
7f97f49c
(feat): return report by urn on repo
· 545f6462
Mark Harding
authored
36 minutes ago
545f6462
(fix): use seconds not milliseconds
· cf8726fa
Mark Harding
authored
36 minutes ago
cf8726fa
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
61 additions
and
5 deletions
+61
-5
jury.php
Controllers/api/v2/moderation/jury.php
+16
-1
JuryClosedException.php
Core/Reports/Jury/JuryClosedException.php
+7
-0
Manager.php
Core/Reports/Jury/Manager.php
+23
-1
Repository.php
Core/Reports/Jury/Repository.php
+13
-1
Repository.php
Core/Reports/Strikes/Repository.php
+2
-2
No files found.
Controllers/api/v2/moderation/jury.php
View file @
cf8726fa
...
...
@@ -11,6 +11,7 @@ use Minds\Entities\Activity;
use
Minds\Interfaces
;
use
Minds\Core\Di\Di
;
use
Minds\Core\Reports\Jury\Decision
;
use
Minds\Core\Reports\Jury\JuryClosedException
;
class
jury
implements
Interfaces\Api
{
...
...
@@ -26,6 +27,13 @@ class jury implements Interfaces\Api
$juryManager
->
setJuryType
(
$juryType
)
->
setUser
(
Core\Session
::
getLoggedInUser
());
if
(
isset
(
$pages
[
1
]))
{
$report
=
$juryManager
->
getReport
(
$pages
[
1
]);
return
Factory
::
response
([
'report'
=>
$report
?
$report
->
export
()
:
null
,
]);
}
$reports
=
$juryManager
->
getUnmoderatedList
([
'limit'
=>
12
,
'hydrate'
=>
true
,
...
...
@@ -83,7 +91,14 @@ class jury implements Interfaces\Api
->
setJurorGuid
(
Core\Session
::
getLoggedInUser
()
->
getGuid
())
->
setJurorHash
(
Core\Session
::
getLoggedInUser
()
->
getPhoneNumberHash
());
$juryManager
->
cast
(
$decision
);
try
{
$juryManager
->
cast
(
$decision
);
}
catch
(
JuryClosedException
$e
)
{
return
Factory
::
response
([
'status'
=>
'error'
,
'message'
=>
'The jury has already closed'
]);
}
return
Factory
::
response
([]);
}
...
...
This diff is collapsed.
Click to expand it.
Core/Reports/Jury/JuryClosedException.php
0 → 100644
View file @
cf8726fa
<?php
namespace
Minds\Core\Reports\Jury
;
class
JuryClosedException
extends
\Exception
{
protected
$message
=
"The jury has closed"
;
}
This diff is collapsed.
Click to expand it.
Core/Reports/Jury/Manager.php
View file @
cf8726fa
...
...
@@ -105,6 +105,23 @@ class Manager
return
$response
;
}
/**
* Return a single report
* @param string $urn
* @return Report
*/
public
function
getReport
(
$urn
)
{
$report
=
$this
->
repository
->
get
(
$urn
);
if
(
$report
)
{
$entity
=
$this
->
entitiesResolver
->
single
(
(
new
Urn
())
->
setUrn
(
$report
->
getEntityUrn
())
);
$report
->
setEntity
(
$entity
);
}
return
$report
;
}
/**
* Cast a decision
* @param Decision $decision
...
...
@@ -112,9 +129,14 @@ class Manager
*/
public
function
cast
(
Decision
$decision
)
{
$report
=
$decision
->
getReport
();
if
(
!
in_array
(
$report
->
getState
(),
[
'reported'
,
'appealed'
]))
{
throw
new
JuryClosedException
();
}
$success
=
$this
->
repository
->
add
(
$decision
);
$report
=
$decision
->
getReport
();
if
(
$decision
->
isAppeal
())
{
$decisions
=
$report
->
getAppealJuryDecisions
();
$decisions
[]
=
$decision
;
...
...
This diff is collapsed.
Click to expand it.
Core/Reports/Jury/Repository.php
View file @
cf8726fa
...
...
@@ -53,7 +53,7 @@ class Repository
],
$opts
);
if
(
!
$opts
[
'user'
]
->
getPhoneNumberHash
())
{
//
return null;
return
null
;
}
$statement
=
"SELECT * FROM moderation_reports_by_state
...
...
@@ -89,6 +89,18 @@ class Repository
return
$response
;
}
/**
* Return a single report
* @param string $urn
* @return Report
*/
public
function
get
(
$urn
)
{
// TODO: Do not return if we no longer meet criteria
return
$this
->
reportsRepository
->
get
(
$urn
);
}
/**
* Add a decision for a report
* @param Decision $decision
...
...
This diff is collapsed.
Click to expand it.
Core/Reports/Strikes/Repository.php
View file @
cf8726fa
...
...
@@ -72,12 +72,12 @@ class Repository
if
(
$opts
[
'from'
])
{
$statement
.=
" AND timestamp > ?"
;
$values
[]
=
new
Timestamp
(
$opts
[
'from'
]
*
1000
);
$values
[]
=
new
Timestamp
(
$opts
[
'from'
]);
}
if
(
$opts
[
'to'
])
{
$statement
.=
" AND timestamp < ?"
;
$values
[]
=
new
Timestamp
(
$opts
[
'to'
]
*
1000
);
$values
[]
=
new
Timestamp
(
$opts
[
'to'
]);
}
if
(
!
isset
(
$opts
[
'reason_code'
])
&&
!
isset
(
$opts
[
'sub_reason_code'
]))
{
...
...
This diff is collapsed.
Click to expand it.