Skip to content
Next
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Switch to GitLab Next
Sign in / Register
Toggle navigation
Minds Backend - Engine
Project
Project
Details
Activity
Releases
Cycle Analytics
Insights
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Locked Files
Issues
220
Issues
220
List
Boards
Labels
Service Desk
Milestones
Merge Requests
37
Merge Requests
37
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Security & Compliance
Security & Compliance
Dependency List
Packages
Packages
List
Container Registry
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
c96f482e
Commit
c96f482e
authored
10 minutes ago
by
Ben Hayward
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changed location of call and put ban reasons in settings
parent
6ba755df
fix/report-reason-email-765
1 merge request
!328
[Sprint/NuancedNumbat](fix): Ban email now returning string of ban reason rather than index.
Pipeline
#84124651
canceled with stages
in 2 seconds
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
48 additions
and
36 deletions
+48
-36
Ban.php
Core/Channels/Delegates/Ban.php
+0
-28
Events.php
Core/Reports/Events.php
+13
-2
BanSpec.php
Spec/Core/Channels/Delegates/BanSpec.php
+0
-5
EventsSpec.php
Spec/Core/Reports/EventsSpec.php
+18
-1
settings.example.php
settings.example.php
+17
-0
No files found.
Core/Channels/Delegates/Ban.php
View file @
c96f482e
...
...
@@ -16,23 +16,6 @@ class Ban
/** @var EventsDispatcher */
protected
$eventsDispatcher
;
private
const
REASONS
=
array
(
1
=>
'is illegal'
,
2
=>
'Should be marked as explicit'
,
3
=>
'Encourages or incites violence'
,
4
=>
'Harassment'
,
5
=>
'contains personal and confidential info'
,
6
=>
'Maliciously targets users (@name, links, images or videos)'
,
7
=>
'Impersonates someone in a misleading or deceptive manner'
,
8
=>
'is spam'
,
10
=>
'is a copyright infringement'
,
11
=>
'Another reason'
,
12
=>
'Incorrect use of hashtags'
,
13
=>
'Malware'
,
15
=>
'Trademark infringement'
,
16
=>
'Token manipulation'
,
);
public
function
__construct
(
$eventsDispatcher
=
null
)
{
$this
->
eventsDispatcher
=
$eventsDispatcher
?:
Di
::
_
()
->
get
(
'EventsDispatcher'
);
...
...
@@ -61,15 +44,4 @@ class Ban
return
$saved
;
}
/**
* Gets the text of a reason associated with a ban_reason index.
*
* @param int $i ban_reason index.
* @return string text reason e.g. "is illegal".
*/
public
function
getReasonText
(
$i
)
{
return
static
::
REASONS
[
$i
];
}
}
This diff is collapsed.
Click to expand it.
Core/Reports/Events.php
View file @
c96f482e
...
...
@@ -7,12 +7,18 @@
use
Minds\Core
;
use
Minds\Entities
;
use
Minds\Helpers
;
use
Minds\Core\Di\Di
;
use
Minds\Core\Analytics\Metrics\Event
;
use
Minds\Core\Events\Dispatcher
;
use
Minds\Core\Channels\Delegates\Ban
;
class
Events
{
{
public
function
__construct
()
{
$this
->
config
=
Di
::
_
()
->
get
(
'Config'
);
}
public
function
register
()
{
Core\Di\Di
::
_
()
->
get
(
'EventsDispatcher'
)
->
register
(
'ban'
,
'user'
,
function
(
$event
)
{
...
...
@@ -24,7 +30,7 @@ class Events
->
setBody
(
'banned.tpl'
)
->
set
(
'username'
,
$user
->
username
)
->
set
(
'email'
,
$user
->
getEmail
())
->
set
(
'reason'
,
get
ReasonText
(
$user
->
ban_reason
))
->
set
(
'reason'
,
get
BanReasons
(
$user
->
ban_reason
))
->
set
(
'user'
,
$user
);
$message
=
new
Core\Email\Message
();
$message
->
setTo
(
$user
)
...
...
@@ -45,4 +51,9 @@ class Events
->
push
();
});
}
public
function
getBanReasons
(
$index
)
{
return
$this
->
config
->
get
(
'ban_reasons'
)[
$index
];
}
}
This diff is collapsed.
Click to expand it.
Spec/Core/Channels/Delegates/BanSpec.php
View file @
c96f482e
...
...
@@ -47,9 +47,4 @@ class BanSpec extends ObjectBehavior
->
shouldReturn
(
true
);
}
public
function
it_should_discern_ban_reason_text
()
{
$this
->
getReasonText
(
1
)
->
shouldReturn
(
"is illegal"
);
}
}
This diff is collapsed.
Click to expand it.
Spec/Core/Reports/EventsSpec.php
View file @
c96f482e
...
...
@@ -7,18 +7,21 @@ use Minds\Core\Events\EventsDispatcher;
use
Minds\Core\Reports\Events
;
use
PhpSpec\ObjectBehavior
;
use
Prophecy\Argument
;
use
Minds\Core\Config
;
class
EventsSpec
extends
ObjectBehavior
{
/** @var EventsDispatcher */
protected
$dispatcher
;
protected
$config
;
public
function
let
(
EventsDispatcher
$dispatcher
)
public
function
let
(
EventsDispatcher
$dispatcher
,
Config
$config
)
{
Di
::
_
()
->
bind
(
'EventsDispatcher'
,
function
(
$di
)
use
(
$dispatcher
)
{
return
$dispatcher
->
getWrappedObject
();
});
$this
->
dispatcher
=
$dispatcher
;
$this
->
config
=
$config
;
}
public
function
it_is_initializable
()
...
...
@@ -33,4 +36,18 @@ class EventsSpec extends ObjectBehavior
$this
->
register
();
}
public
function
it_should_discern_ban_reason_text
()
{
$reasons
=
[
1
=>
'is illegal'
,
2
=>
'Should be marked as explicit'
,
3
=>
'Encourages or incites violence'
,
];
Di
::
_
()
->
get
(
'Config'
)
->
set
(
'ban_reasons'
,
$reasons
);
$this
->
getBanReasons
(
1
)
->
shouldReturn
(
"is illegal"
);
}
}
This diff is collapsed.
Click to expand it.
settings.example.php
View file @
c96f482e
...
...
@@ -572,3 +572,20 @@ $CONFIG->set('gitlab', [
],
'private_key'
=>
''
]);
$CONFIG
->
set
(
'ban_reasons'
,
[
1
=>
'is illegal'
,
2
=>
'Should be marked as explicit'
,
3
=>
'Encourages or incites violence'
,
4
=>
'Harassment'
,
5
=>
'contains personal and confidential info'
,
6
=>
'Maliciously targets users (@name, links, images or videos)'
,
7
=>
'Impersonates someone in a misleading or deceptive manner'
,
8
=>
'is spam'
,
10
=>
'is a copyright infringement'
,
11
=>
'Another reason'
,
12
=>
'Incorrect use of hashtags'
,
13
=>
'Malware'
,
15
=>
'Trademark infringement'
,
16
=>
'Token manipulation'
]);
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