diff options
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; } |