aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/DB/Result/Comment.pm
diff options
context:
space:
mode:
Diffstat (limited to 'perllib/FixMyStreet/DB/Result/Comment.pm')
-rw-r--r--perllib/FixMyStreet/DB/Result/Comment.pm26
1 files changed, 12 insertions, 14 deletions
diff --git a/perllib/FixMyStreet/DB/Result/Comment.pm b/perllib/FixMyStreet/DB/Result/Comment.pm
index 8a4dbe475..b35c5fd0c 100644
--- a/perllib/FixMyStreet/DB/Result/Comment.pm
+++ b/perllib/FixMyStreet/DB/Result/Comment.pm
@@ -253,24 +253,22 @@ sub meta_line {
return $meta;
};
+sub problem_state_processed {
+ my $self = shift;
+ return 'fixed - user' if $self->mark_fixed;
+ return 'confirmed' if $self->mark_open;
+ return $self->problem_state;
+}
+
sub problem_state_display {
my ( $self, $c ) = @_;
- my $update_state = '';
- my $cobrand = $c->cobrand->moniker;
-
- if ($self->mark_fixed) {
- return FixMyStreet::DB->resultset("State")->display('fixed', 1);
- } elsif ($self->mark_open) {
- return FixMyStreet::DB->resultset("State")->display('confirmed', 1);
- } elsif ($self->problem_state) {
- my $state = $self->problem_state;
- my $cobrand_name = $cobrand;
- $cobrand_name = 'bromley' if $self->problem->to_body_named('Bromley');
- $update_state = FixMyStreet::DB->resultset("State")->display($state, 1, $cobrand_name);
- }
+ my $state = $self->problem_state_processed;
+ return '' unless $state;
- return $update_state;
+ my $cobrand_name = $c->cobrand->moniker;
+ $cobrand_name = 'bromley' if $self->problem->to_body_named('Bromley');
+ return FixMyStreet::DB->resultset("State")->display($state, 1, $cobrand_name);
}
sub is_latest {