aboutsummaryrefslogtreecommitdiffstats
path: root/perllib
diff options
context:
space:
mode:
authorMatthew Somerville <matthew-github@dracos.co.uk>2016-10-14 14:01:42 +0100
committerMatthew Somerville <matthew@mysociety.org>2016-10-20 11:50:12 +0100
commit51a83fee9ff77c9a0c9eea1ce10ac43793118d0e (patch)
tree24a7a0ffbcfaa5d5bda990292d4e65b6a2cea969 /perllib
parentfbe159d78ce133cadf79645660f49ddf7bfbc569 (diff)
Fix list of response templates for a problem.
Instead of returning all templates for the problem's body, return those for the problem's category (or with no category).
Diffstat (limited to 'perllib')
-rw-r--r--perllib/FixMyStreet/DB/Result/Problem.pm10
1 files changed, 6 insertions, 4 deletions
diff --git a/perllib/FixMyStreet/DB/Result/Problem.pm b/perllib/FixMyStreet/DB/Result/Problem.pm
index 855732f83..ae713ef2d 100644
--- a/perllib/FixMyStreet/DB/Result/Problem.pm
+++ b/perllib/FixMyStreet/DB/Result/Problem.pm
@@ -658,13 +658,15 @@ order of title.
=cut
sub response_templates {
- my $problem = shift;
- return $problem->result_source->schema->resultset('ResponseTemplate')->search(
+ my $self = shift;
+ return $self->result_source->schema->resultset('ResponseTemplate')->search(
{
- body_id => $problem->bodies_str_ids
+ 'me.body_id' => $self->bodies_str_ids,
+ 'contact.category' => [ $self->category, undef ],
},
{
- order_by => 'title'
+ order_by => 'title',
+ join => { 'contact_response_templates' => 'contact' },
}
);
}