diff options
author | pezholio <pezholio@gmail.com> | 2017-01-17 15:31:10 +0000 |
---|---|---|
committer | pezholio <pezholio@gmail.com> | 2017-01-17 15:31:10 +0000 |
commit | 4f9b830445bf2721ca8be0ff8285b095fe5b8688 (patch) | |
tree | cc4c04fd94d4074ba9f717e900a6d69e3c0265a2 /perllib | |
parent | f90c19b4d67cd4ea24cb7050326e74ad30582f19 (diff) | |
parent | e81d5b686a44e7a07db276cccc718c4e28a28a1c (diff) |
Merge remote-tracking branch 'origin/issues/forcouncils/136-show-user-details-for-council-report'
Diffstat (limited to 'perllib')
-rw-r--r-- | perllib/FixMyStreet/Cobrand/Default.pm | 1 | ||||
-rw-r--r-- | perllib/FixMyStreet/Cobrand/UKCouncils.pm | 1 | ||||
-rw-r--r-- | perllib/FixMyStreet/DB/Result/Problem.pm | 16 |
3 files changed, 14 insertions, 4 deletions
diff --git a/perllib/FixMyStreet/Cobrand/Default.pm b/perllib/FixMyStreet/Cobrand/Default.pm index 61982c47a..aad91429a 100644 --- a/perllib/FixMyStreet/Cobrand/Default.pm +++ b/perllib/FixMyStreet/Cobrand/Default.pm @@ -713,6 +713,7 @@ sub available_permissions { planned_reports => _("Manage shortlist"), contribute_as_another_user => _("Create reports/updates on a user's behalf"), contribute_as_body => _("Create reports/updates as the council"), + view_body_contribute_details => _("See user detail for reports created as the council"), # NB this permission is special in that it can be assigned to users # without their from_body being set. It's included here for diff --git a/perllib/FixMyStreet/Cobrand/UKCouncils.pm b/perllib/FixMyStreet/Cobrand/UKCouncils.pm index 64ca7fc62..4e900e653 100644 --- a/perllib/FixMyStreet/Cobrand/UKCouncils.pm +++ b/perllib/FixMyStreet/Cobrand/UKCouncils.pm @@ -200,6 +200,7 @@ sub available_permissions { my $perms = $self->next::method(); $perms->{Problems}->{contribute_as_body} = "Create reports/updates as " . $self->council_name; + $perms->{Problems}->{view_body_contribute_details} = "See user detail for reports created as " . $self->council_name; $perms->{Users}->{user_assign_areas} = "Assign users to areas in " . $self->council_name; return $perms; diff --git a/perllib/FixMyStreet/DB/Result/Problem.pm b/perllib/FixMyStreet/DB/Result/Problem.pm index 203e72fae..92c5c160a 100644 --- a/perllib/FixMyStreet/DB/Result/Problem.pm +++ b/perllib/FixMyStreet/DB/Result/Problem.pm @@ -606,20 +606,28 @@ sub meta_line { $meta = sprintf( _('Reported anonymously at %s'), $date_time ); } } else { + my $problem_name = $problem->name; + + if ($c->user_exists and + $c->user->has_permission_to('view_body_contribute_details', $problem->bodies_str_ids) and + $problem->name ne $problem->user->name) { + $problem_name = sprintf( _('%s (%s)'), $problem->name, $problem->user->name ); + } + if ( $problem->service and $category && $category ne _('Other') ) { $meta = sprintf( _('Reported via %s in the %s category by %s at %s'), $problem->service, $category, - $problem->name, $date_time + $problem_name, $date_time ); } elsif ( $problem->service ) { $meta = sprintf( _('Reported via %s by %s at %s'), - $problem->service, $problem->name, $date_time ); + $problem->service, $problem_name, $date_time ); } elsif ( $category and $category ne _('Other') ) { $meta = sprintf( _('Reported in the %s category by %s at %s'), - $category, $problem->name, $date_time ); + $category, $problem_name, $date_time ); } else { - $meta = sprintf( _('Reported by %s at %s'), $problem->name, $date_time ); + $meta = sprintf( _('Reported by %s at %s'), $problem_name, $date_time ); } } |