yournextrepresentative icon indicating copy to clipboard operation
yournextrepresentative copied to clipboard

Logs for actions at post- rather than candidate- level

Open jf1 opened this issue 8 years ago • 3 comments

Changes to candidates are logged and displayed on each candidate's page, however neither locking a post nor uploading its SoPN are displayed on the post's page. It seems that locking is logged but uploading isn't.

Previously other posts had errors so I was curious to know how they'd arisen. Tonight this post was locked despite there being no SoPN, so it'd be useful to know who locked the post or removed the SoPN. This highlights another potential issue - should it be possible to lock a post if there's no SoPN?

It may also be useful to be able to add a note to the logs and/or flag a post, candidate or user action for inspection by a site admin; not to make a scene out of the occasional genuine mistake, but to provide way to track vandalism or frequent mistakes - or more positively, to highlight which users have made so few mistakes that they should be considered for elevated privileges.

jf1 avatar Apr 30 '16 21:04 jf1

As a first step, the API could allow filtering logged actions by action_type, source and user. The post log entries aren't actually associated with a post; constituency locking and unlocking was just kinda shoehorned into the log by reappropriating the source field.

See also #372 and #373.

wfdd avatar Apr 30 '16 23:04 wfdd

LoggedAction does at least have a post field now in the DC fork. I think the following steps are needed:

  • [ ] Add the post field to LoggedAction (probably by cherry-picking 1aa03a2ee993348ca6)
  • [ ] Update the code that records the lock / unlock
  • [ ] Add a data migration that looks at all the constituency lock / unlocked LoggedActions and set the post field on them
  • [ ] Add filters to the logged action endpoint of the API, as @wfdd suggests
  • [ ] Possibly do the same for other actions, e.g. set-candidate-elected and set-candidate-not-elected
  • [ ] Include a "recent changes" list at the bottom of each post page

mhl avatar May 06 '16 11:05 mhl

Might be useful to factor in or be mindful of the potential to store post-level values for 'incumbent person' and 'incumbent party' mentioned in https://github.com/mysociety/yournextrepresentative/issues/901

jf1 avatar May 06 '16 12:05 jf1