diff options
author | Marius Halden <marius.h@lden.org> | 2019-10-30 19:28:55 +0100 |
---|---|---|
committer | Marius Halden <marius.h@lden.org> | 2019-10-30 19:28:55 +0100 |
commit | 377bd96aab7cad3434185c30eb908c9da447fe40 (patch) | |
tree | 7ec5527e205d5b62caaa862a7de8cd25199c8bf0 /perllib/FixMyStreet/Script/Questionnaires.pm | |
parent | 56f61b1441070aa0b9ddcfc74aca46c20313609f (diff) | |
parent | 92b253904062edd533e55c22824de6fd01e2f7c1 (diff) |
Merge tag 'v2.6' into fiksgatami-dev
Diffstat (limited to 'perllib/FixMyStreet/Script/Questionnaires.pm')
-rw-r--r-- | perllib/FixMyStreet/Script/Questionnaires.pm | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/perllib/FixMyStreet/Script/Questionnaires.pm b/perllib/FixMyStreet/Script/Questionnaires.pm index 5fc01512d..aab4b9b75 100644 --- a/perllib/FixMyStreet/Script/Questionnaires.pm +++ b/perllib/FixMyStreet/Script/Questionnaires.pm @@ -43,14 +43,19 @@ sub send_questionnaires_period { while (my $row = $unsent->next) { - my $cobrand = FixMyStreet::Cobrand->get_class_for_moniker($row->cobrand)->new(); + my $cobrand = $row->get_cobrand_logged; $cobrand->set_lang_and_domain($row->lang, 1); FixMyStreet::Map::set_map_class($cobrand->map_type); # Not all cobrands send questionnaires next unless $cobrand->send_questionnaires; - if ($row->is_from_abuser || !$row->user->email_verified) { + # Cobrands can also override sending per row if they wish + my $cobrand_send = $cobrand->call_hook('send_questionnaire', $row) // 1; + + if ($row->is_from_abuser || !$row->user->email_verified || + !$cobrand_send || $row->is_closed + ) { $row->update( { send_questionnaire => 0 } ); next; } |