From c7d98f98bf4faa1a60552dd11195eb134445b6b3 Mon Sep 17 00:00:00 2001 From: Matthew Somerville Date: Wed, 27 Sep 2017 14:46:46 +0100 Subject: Adapt things that assume email will be present. This includes stopping some emails being sent (moderation, alert, questionnaire), dealing with Open311/email report sending, and tokenised_url. --- perllib/FixMyStreet/App/Controller/Moderate.pm | 28 ++++++++++++++------------ 1 file changed, 15 insertions(+), 13 deletions(-) (limited to 'perllib/FixMyStreet/App/Controller/Moderate.pm') diff --git a/perllib/FixMyStreet/App/Controller/Moderate.pm b/perllib/FixMyStreet/App/Controller/Moderate.pm index e2ab16b6b..1313b5071 100644 --- a/perllib/FixMyStreet/App/Controller/Moderate.pm +++ b/perllib/FixMyStreet/App/Controller/Moderate.pm @@ -106,19 +106,21 @@ sub report_moderate_audit : Private { reason => (sprintf '%s (%s)', $reason, $types_csv), }); - my $token = $c->model("DB::Token")->create({ - scope => 'moderation', - data => { id => $problem->id } - }); - - $c->send_email( 'problem-moderated.txt', { - to => [ [ $problem->user->email, $problem->name ] ], - types => $types_csv, - user => $problem->user, - problem => $problem, - report_uri => $c->stash->{report_uri}, - report_complain_uri => $c->stash->{cobrand_base} . '/contact?m=' . $token->token, - }); + if ($problem->user->email_verified) { + my $token = $c->model("DB::Token")->create({ + scope => 'moderation', + data => { id => $problem->id } + }); + + $c->send_email( 'problem-moderated.txt', { + to => [ [ $problem->user->email, $problem->name ] ], + types => $types_csv, + user => $problem->user, + problem => $problem, + report_uri => $c->stash->{report_uri}, + report_complain_uri => $c->stash->{cobrand_base} . '/contact?m=' . $token->token, + }); + } } sub report_moderate_hide : Private { -- cgit v1.2.3 From 69cd91b70b488ebba89558cbc41d2472ecbbec5a Mon Sep 17 00:00:00 2001 From: Struan Donald Date: Mon, 18 Sep 2017 16:46:47 +0100 Subject: log all state changes in admin as comments Create a comment on a problem when the admin is used to change the state of the problem. If only the state is changed then create a comment with blank text. If the category and state are changing then include details of the category change in the comment. Not all the state changes are displayed at the template level by default. Fixes #1846 --- perllib/FixMyStreet/App/Controller/Moderate.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'perllib/FixMyStreet/App/Controller/Moderate.pm') diff --git a/perllib/FixMyStreet/App/Controller/Moderate.pm b/perllib/FixMyStreet/App/Controller/Moderate.pm index 1313b5071..42dc759e5 100644 --- a/perllib/FixMyStreet/App/Controller/Moderate.pm +++ b/perllib/FixMyStreet/App/Controller/Moderate.pm @@ -85,7 +85,7 @@ sub moderate_report : Chained('report') : PathPart('') : Args(0) { sub moderating_user_name { my $user = shift; - return $user->from_body ? $user->from_body->name : 'a FixMyStreet administrator'; + return $user->from_body ? $user->from_body->name : _('an administrator'); } sub report_moderate_audit : Private { -- cgit v1.2.3 From 089fbdd8d5a9dc91dd975358f35bfae563c62d49 Mon Sep 17 00:00:00 2001 From: Matthew Somerville Date: Wed, 18 Oct 2017 12:01:19 +0100 Subject: Tidy up report page permission checkings. --- perllib/FixMyStreet/App/Controller/Moderate.pm | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'perllib/FixMyStreet/App/Controller/Moderate.pm') diff --git a/perllib/FixMyStreet/App/Controller/Moderate.pm b/perllib/FixMyStreet/App/Controller/Moderate.pm index 42dc759e5..4d3a97fa8 100644 --- a/perllib/FixMyStreet/App/Controller/Moderate.pm +++ b/perllib/FixMyStreet/App/Controller/Moderate.pm @@ -21,10 +21,7 @@ data to change. (Authentication requires: - user to be from_body - - user to have a "moderate" record in user_body_permissions (there is - currently no admin interface for this. Should be added, but - while we're trialing this, it's a simple case of adding a DB record - manually) + - user to have a "moderate" record in user_body_permissions The original data of the report is stored in moderation_original_data, so that it can be reverted/consulted if required. All moderation events are -- cgit v1.2.3 From 1986cacd1518b876d11df31cde60b896d91a80cb Mon Sep 17 00:00:00 2001 From: Dave Arter Date: Wed, 22 Nov 2017 10:43:25 +0000 Subject: Allow cobrands to disable moderation emails MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This adds a new send_moderation_notifications method which can be overridden by cobrands to prevent “your report has been moderated” emails from being sent. Fixes mysociety/fixmystreet-commercial#936 --- perllib/FixMyStreet/App/Controller/Moderate.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'perllib/FixMyStreet/App/Controller/Moderate.pm') diff --git a/perllib/FixMyStreet/App/Controller/Moderate.pm b/perllib/FixMyStreet/App/Controller/Moderate.pm index 4d3a97fa8..a8e0b7a3c 100644 --- a/perllib/FixMyStreet/App/Controller/Moderate.pm +++ b/perllib/FixMyStreet/App/Controller/Moderate.pm @@ -103,7 +103,7 @@ sub report_moderate_audit : Private { reason => (sprintf '%s (%s)', $reason, $types_csv), }); - if ($problem->user->email_verified) { + if ($problem->user->email_verified && $c->cobrand->send_moderation_notifications) { my $token = $c->model("DB::Token")->create({ scope => 'moderation', data => { id => $problem->id } -- cgit v1.2.3