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
Commits
f6610dbc
Commit
f6610dbc
authored
14 minutes ago
by
Mark Harding
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(feat): do not allow appeal to be made unless just after initial_jury
parent
2acc61f0
epic/ReportingAndModeration
1 merge request
!100
Epic/reporting and moderation
Pipeline
#61688932
passed with stages
in 4 minutes and 53 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
37 additions
and
1 deletion
+37
-1
Manager.php
Core/Reports/Appeals/Manager.php
+4
-0
NotAppealableException.php
Core/Reports/Appeals/NotAppealableException.php
+7
-0
ManagerSpec.php
Spec/Core/Reports/Appeals/ManagerSpec.php
+26
-1
No files found.
Core/Reports/Appeals/Manager.php
View file @
f6610dbc
...
...
@@ -71,6 +71,10 @@ class Manager
*/
public
function
appeal
(
Appeal
$appeal
)
{
if
(
$appeal
->
getReport
()
->
getState
()
!==
'initial_jury_decided'
)
{
throw
new
NotAppealableException
();
}
$added
=
$this
->
repository
->
add
(
$appeal
);
$this
->
notificationDelegate
->
onAction
(
$appeal
);
...
...
This diff is collapsed.
Click to expand it.
Core/Reports/Appeals/NotAppealableException.php
0 → 100644
View file @
f6610dbc
<?php
namespace
Minds\Core\Reports\Appeals
;
class
NotAppealableException
extends
\Exception
{
protected
$message
=
"This report is not able to be appealed"
;
}
This diff is collapsed.
Click to expand it.
Spec/Core/Reports/Appeals/ManagerSpec.php
View file @
f6610dbc
...
...
@@ -75,7 +75,7 @@ class ManagerSpec extends ObjectBehavior
->
shouldBe
(
456
);
}
function
it_should_add_appeal_to_repository
(
Appeal
$appeal
)
function
it_should_add_appeal_to_repository
(
Appeal
$appeal
,
Report
$report
)
{
$this
->
repository
->
add
(
$appeal
)
->
shouldBeCalled
()
...
...
@@ -84,8 +84,33 @@ class ManagerSpec extends ObjectBehavior
$this
->
notificationDelegate
->
onAction
(
$appeal
)
->
shouldBeCalled
();
$appeal
->
getReport
()
->
willReturn
(
$report
);
$report
->
getState
()
->
willReturn
(
'initial_jury_decided'
);
$this
->
appeal
(
$appeal
)
->
shouldBe
(
true
);
}
function
it_should_NOT_add_appeal_to_repository_if_not_been_to_initial_jury
(
Appeal
$appeal
,
Report
$report
)
{
$this
->
repository
->
add
(
$appeal
)
->
shouldNotBeCalled
()
->
willReturn
(
true
);
$this
->
notificationDelegate
->
onAction
(
$appeal
)
->
shouldNotBeCalled
();
$appeal
->
getReport
()
->
willReturn
(
$report
);
$report
->
getState
()
->
willReturn
(
'reported'
);
$this
->
shouldThrow
(
'Minds\Core\Reports\Appeals\NotAppealableException'
)
->
duringAppeal
(
$appeal
);
}
}
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