aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet
diff options
context:
space:
mode:
Diffstat (limited to 'perllib/FixMyStreet')
-rw-r--r--perllib/FixMyStreet/App/Controller/Moderate.pm4
-rw-r--r--perllib/FixMyStreet/App/Controller/Report/New.pm6
-rw-r--r--perllib/FixMyStreet/DB/Result/User.pm11
3 files changed, 20 insertions, 1 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Moderate.pm b/perllib/FixMyStreet/App/Controller/Moderate.pm
index 45a303309..c47c34f37 100644
--- a/perllib/FixMyStreet/App/Controller/Moderate.pm
+++ b/perllib/FixMyStreet/App/Controller/Moderate.pm
@@ -75,7 +75,9 @@ sub moderate_report : Chained('report') : PathPart('') : Args(0) {
$c->forward('report_moderate_hide');
my @types = grep $_,
- $c->forward('moderate_text', [ 'title' ]),
+ ($c->user->can_moderate_title($c->stash->{problem}, 1)
+ ? $c->forward('moderate_text', [ 'title' ])
+ : ()),
$c->forward('moderate_text', [ 'detail' ]),
$c->forward('moderate_boolean', [ 'anonymous', 'show_name' ]),
$c->forward('moderate_boolean', [ 'photo' ]);
diff --git a/perllib/FixMyStreet/App/Controller/Report/New.pm b/perllib/FixMyStreet/App/Controller/Report/New.pm
index 869ed9461..dd4fef388 100644
--- a/perllib/FixMyStreet/App/Controller/Report/New.pm
+++ b/perllib/FixMyStreet/App/Controller/Report/New.pm
@@ -418,6 +418,12 @@ sub report_import : Path('/import') {
$c->send_email( 'partial.txt', { to => $report->user->email, } );
+ if ( $c->get_param('web') ) {
+ $c->res->content_type('text/html; charset=utf-8');
+ $c->stash->{template} = 'email_sent.html';
+ $c->stash->{email_type} = 'problem';
+ return 1;
+ }
$c->res->body('SUCCESS');
return 1;
}
diff --git a/perllib/FixMyStreet/DB/Result/User.pm b/perllib/FixMyStreet/DB/Result/User.pm
index 246159009..c50f8834c 100644
--- a/perllib/FixMyStreet/DB/Result/User.pm
+++ b/perllib/FixMyStreet/DB/Result/User.pm
@@ -350,6 +350,17 @@ sub can_moderate {
return $cobrand->call_hook('moderate_permission', $self, $type => $object);
}
+sub can_moderate_title {
+ my ($self, $problem, $perm) = @_;
+
+ # Must have main permission, this is to potentially restrict only
+ return 0 unless $perm;
+
+ # If hook returns anything use it, otherwise default to yes
+ my $cobrand = $self->result_source->schema->cobrand;
+ return $cobrand->call_hook('moderate_permission_title', $self, $problem) // 1;
+}
+
has body_permissions => (
is => 'ro',
lazy => 1,