mysociety / alaveteli

Provide a Freedom of Information request system for your jurisdiction
https://alaveteli.org
Other
386 stars 195 forks source link

Select all button for checkboxes on list of incoming messages at least on holding pen #5432

Open RichardTaylor opened 4 years ago

RichardTaylor commented 4 years ago

When dealing with spam in the holding pen it would be useful to be able to select all incoming messages then delete them all in one go.

Currently an administrator has to select each message individually which can be tedious when there are many.

Sometimes this feature might be useful on a normal request page too, as spam can arrive on a normal request thread.

This hasn't been requested to-date as for quite a few months now on WhatDoTheyKnow there hasn't been an issue with spam hitting the holding pen - probably due to developer/sysadmin action to prevent it.

Prevention is better than human admin action.

Related: #3324 which is for this feature in relation to annotations.

This might be part of a wider set of features which could move us towards taking admin actions in bulk rather than on a per request basis - a strategy which could help reduce human admin effort as sites grow

garethrees commented 1 year ago

Since https://github.com/mysociety/alaveteli/pull/6801, this could be as easy as just including the link with the correct data-target value as per https://github.com/mysociety/alaveteli/pull/6801/files#diff-74f7f2411b850593ea281bcccc41391a191888ee9a42163fbe5fea7e504d7681R57-R59.

Something like:

<% if @info_request == InfoRequest.holding_pen_request %>
  <a href="#" class="select_all" data-state="unchecked" data-target="incoming_message_ids[]">
    Select all
  </a>
<% end %>

Annoyingly it looks like the attributes of the incoming message checkbox is like name="message_id_7" value="7", rather than as per comments: name="comment_ids[]" value="43", so that would need to get modified in order to work with the current select all library function. Not sure of the impact of that – possibly need some controller updates.