diff options
author | Dave Arter <davea@mysociety.org> | 2017-02-01 11:40:38 +0000 |
---|---|---|
committer | Dave Arter <davea@mysociety.org> | 2017-02-15 17:36:40 +0000 |
commit | 0b1bc26366811481b322c322f2414514bb7c2166 (patch) | |
tree | 6e2827a4958dcd48f2aa97871d2bf426d1ce3fc2 /perllib | |
parent | 71e4186cefa356f240870cd5edf0e15b27e5e044 (diff) |
Allow cobrands to control which states affect reputation
Rather than assigning +1 to a user's reputation every time a report is
inspected, this allows cobrands to specify which states should increment or
decrement the reputation value when a report is inspected.
The default behaviour is for reputation to never be changed, but the Oxfordshire
cobrand will increment the reputation when a report is marked as 'action
scheduled'.
For mysociety/fixmystreetforcouncils#119
Diffstat (limited to 'perllib')
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Report.pm | 4 | ||||
-rw-r--r-- | perllib/FixMyStreet/Cobrand/Default.pm | 10 |
2 files changed, 13 insertions, 1 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Report.pm b/perllib/FixMyStreet/App/Controller/Report.pm index ad26ecf84..5c34630c4 100644 --- a/perllib/FixMyStreet/App/Controller/Report.pm +++ b/perllib/FixMyStreet/App/Controller/Report.pm @@ -377,7 +377,9 @@ sub inspect : Private { unless ($problem->get_extra_metadata('inspected')) { $problem->set_extra_metadata( inspected => 1 ); $c->forward( '/admin/log_edit', [ $problem->id, 'problem', 'inspected' ] ); - $reputation_change = 1; + my $state = $problem->state; + $reputation_change = 1 if $c->cobrand->reputation_increment_states->{$state}; + $reputation_change = -1 if $c->cobrand->reputation_decrement_states->{$state}; } } } diff --git a/perllib/FixMyStreet/Cobrand/Default.pm b/perllib/FixMyStreet/Cobrand/Default.pm index 1fdbe9de2..b8767ab73 100644 --- a/perllib/FixMyStreet/Cobrand/Default.pm +++ b/perllib/FixMyStreet/Cobrand/Default.pm @@ -1188,6 +1188,16 @@ sub category_extra_hidden { return 0; } +=head2 reputation_increment_states/reputation_decrement_states + +Get a hashref of states that cause the reporting user's reputation to be +incremented/decremented, if a report is changed to this state upon inspection. + +=cut + +sub reputation_increment_states { {} }; +sub reputation_decrement_states { {} }; + sub traffic_management_options { return [ _("Yes"), |