codeforcroatia / imamopravoznati

Provide a Freedom of Information request system for your jurisdiction
http://alaveteli.org
Other
3 stars 1 forks source link

Bulk request is not visible when moving all bulk requests to new user #106

Closed schlos closed 2 years ago

schlos commented 2 years ago

Expected Behavior

Current Behavior

Bulk request group is not visible in new user profile when moving all bulk requests to the new user via Alaveteli Admin GUI.

Possible Solution

As shared by Graeme:

In the console if you run: InfoRequest.joins(:info_request_batch).where("info_requests.user_id != info_request_batches.user_id").pluck(:info_request_batch_id).uniq

This should determine which batch IDs are out of sync with the requester. You can then update the batches using a command (with substituted ID values) like: InfoRequestBatch.find(ID).update(user_id: NEW_USER_ID)

Steps to Reproduce (for bugs)

1. 2. 3. 4.

Context

Your Environment

schlos commented 2 years ago

Executed on "alaveteli_version": "0.39.1.6":

schlos@imamopravoznati:~$ cd /var/www/imamopravoznati.org/alaveteli/
schlos@imamopravoznati:/var/www/imamopravoznati.org/alaveteli$ sudo -u alaveteli bundle exec rails console
`/home/schlos` is not writable.
Bundler will use `/tmp/bundler/home/schlos' as your home directory temporarily.
Loading production environment (Rails 5.2.6)
irb(main):001:0> InfoRequest.joins(:info_request_batch).where("info_requests.user_id != info_request_batches.user_id").pluck(:info_request_batch_id).uniq
=> [36]
irb(main):002:0> InfoRequestBatch.find(36).update(user_id: 456)
=> true
garethrees commented 2 years ago

Upstream issue https://github.com/mysociety/alaveteli/issues/6651.

schlos commented 2 years ago

Melisa confirmed this bulk request is now visible. Closing.