Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New authority censor rules are not applied to existing responses #3959

Closed
lizconlan opened this issue May 5, 2017 · 5 comments
Closed

New authority censor rules are not applied to existing responses #3959

lizconlan opened this issue May 5, 2017 · 5 comments
Assignees
Labels
bug Breaks expected functionality

Comments

@lizconlan
Copy link

lizconlan commented May 5, 2017

If you add a censor rule to an authority after a response has been published, the intended redaction only applies to the correspondence header until the message cache (e.g. cached_main_body_text_unfolded) is cleared.

The censor rule intention was to replace the last name of the sender.

screen shot 2017-05-05 at 17 56 58

(May be looking in the wrong place but I can't see how an admin can fix this)

@lizconlan lizconlan added 1 - new bug Breaks expected functionality labels May 5, 2017
@lizconlan
Copy link
Author

Related to #1156

@garethrees
Copy link
Member

garethrees commented May 5, 2017

Needs expire requests before redirecting https://github.com/mysociety/alaveteli/blob/develop/app/controllers/admin_censor_rule_controller.rb#L102-L106

Note that PublicBody doesn't have #expire_requests, but it does have purge_in_cache so worth checking the differences there and seeing whether we can unify these methods a bit.

@lizconlan
Copy link
Author

lizconlan commented May 5, 2017

purge_in_cache is for the Varnish cache, user.expire_requests calls .expire on each request which clears the database caches, cache files and the download zip directory (then calls purge_in_cache). I think PublicBody probably needs its own version

@lizconlan lizconlan self-assigned this May 5, 2017
@lizconlan lizconlan changed the title Authority censor rules are not applied to existing responses New authority censor rules are not applied to existing responses May 10, 2017
@garethrees
Copy link
Member

garethrees commented Jul 27, 2017

Reopening as the existing requests with body censor rules need to get recached.

CensorRule.where('public_body_id IS NOT NULL').each do |rule|
  rule.public_body.info_requests.find_in_batches(batch_size: 100) do |group|
    group.each do |info_request|
      info_request.expire
      puts "Cleared InfoRequest: #{ info_request.id }"
    end
  end
end

@garethrees garethrees reopened this Jul 27, 2017
@garethrees
Copy link
Member

Requests with public body censor rules have been expired.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Breaks expected functionality
Projects
None yet
Development

No branches or pull requests

2 participants