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
145
Issues
145
List
Boards
Labels
Service Desk
Milestones
Merge Requests
38
Merge Requests
38
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
69ef5d61
Commit
69ef5d61
authored
5 minutes ago
by
Mark Harding
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(fix): do not report if tagged as nsfw correctly
parent
a8615d03
master
No related merge requests found
Pipeline
#65712681 (#748)
pending with stages
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
0 deletions
+41
-0
Manager.php
Core/Reports/UserReports/Manager.php
+7
-0
ManagerSpec.php
Spec/Core/Reports/UserReports/ManagerSpec.php
+34
-0
No files found.
Core/Reports/UserReports/Manager.php
View file @
69ef5d61
...
...
@@ -80,6 +80,13 @@ class Manager
if
(
$report
->
getState
()
===
'appeal_jury_decided'
&&
$report
->
isUpheld
())
{
return
true
;
// Do not accept further reports if appeal jury uphols
}
if
(
$report
->
getReasonCode
()
==
2
&&
$report
->
getEntity
()
->
getNsfw
()
&&
in_array
(
$report
->
getSubReasonCode
(),
$report
->
getEntity
()
->
getNsfw
())
)
{
return
true
;
// If the post is NSFW and tagged, do not allow report
}
if
(
$report
->
getState
()
!==
'reported'
)
{
$report
->
setTimestamp
(
time
());
// Create a new report
...
...
This diff is collapsed.
Click to expand it.
Spec/Core/Reports/UserReports/ManagerSpec.php
View file @
69ef5d61
...
...
@@ -9,6 +9,7 @@ use Minds\Core\Reports\UserReports\UserReport;
use
Minds\Core\Reports\UserReports\Delegates
;
use
Minds\Core\Reports\Report
;
use
Minds\Core\Reports\Manager
as
ReportsManager
;
use
Minds\Entities\Activity
;
use
PhpSpec\ObjectBehavior
;
use
Prophecy\Argument
;
...
...
@@ -56,4 +57,37 @@ class ManagerSpec extends ObjectBehavior
$this
->
add
(
$userReport
)
->
shouldReturn
(
true
);
}
function
it_should_not_double_report_marked_nsfw_repository
(
Report
$report
)
{
$entity
=
new
Activity
();
$entity
->
setNsfw
([
3
]);
$report
->
getReasonCode
()
->
willReturn
(
2
);
$report
->
getSubReasonCode
()
->
willReturn
(
3
);
$report
->
getEntity
()
->
willReturn
(
$entity
);
$report
->
getState
()
->
willReturn
(
'reported'
);
$this
->
repository
->
add
(
Argument
::
type
(
UserReport
::
class
))
->
shouldNotBeCalled
();
$this
->
reportsManager
->
getLatestReport
(
Argument
::
type
(
Report
::
class
))
->
shouldBeCalled
()
->
willReturn
(
$report
);
$this
->
notificationDelegate
->
onAction
(
Argument
::
type
(
UserReport
::
class
))
->
shouldNotBeCalled
();
$userReport
=
new
UserReport
;
$userReport
->
setReport
(
$report
);
$this
->
add
(
$userReport
)
->
shouldReturn
(
true
);
}
}
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