Page removal http API update - Option to delete pages permanently

We are currently adding the possibility to let the user choose whether a page is moved to the recycle bin or removed permanently (see XWIKI-17401 - Option for deleting documents and/or attachments without sending to recycle bin for more details).

To communicate the choice of the user, I propose to introduce a new parameter, called toRecycleBin to the page removal form.

  • when the user choose to send the document to the recycle bin, toRecycleBin=1 is sent to the delete action.
  • when the user choose to remove permanently the document, toRecycleBin=0 is sent to the delete action.
  • when the parameter is missing because the user does not have the right to choose, the default behavior of the wiki applies (ie, sending to the recycle bin if it exists, remove permanently otherwise).

See the current Github PR:

Do you agree with the naming of the parameter and the transmitted values?

Globally ok, just a question about the behaviour in DeleteAction though: if the admin chose to not enable the “skipRecycleBin” option, it’s still possible for users to force skipping the recycle bin by using toRecycleBin=0 in the URL?
Shouldn’t the Admin choice have the priority and discard this option if “skipRecycleBin” is not enabled?

That’s a relevant question. In the case where “skipRecycleBin” is not enabled but a toRecycleBin=0 is received, this parameter is not considered and the nominal behavior is applied.

ok +1 then.

I have a small preference for skipRecycleBin as a request parameter rather than toRecycleBin. Since going through recycle bin is the default normally, it feels more natural for me to specify that I want to skip it not that I want to use it. As for the value, if it has only two options (skip or not) then I would use true / false rather than 1 / 0.

I feel the same.

+1 for that, let’s not revive the old and bad habit of meaningless values

+1

Thanks for your comments.

The parameter to communicate the choice of the user is now called skipRecycleBin.

  • when the user choose to send the document to the recycle bin, skipRecycleBin=false is sent to the delete action.
  • when the user choose to remove permanently the document, skipRecycleBin=true is sent to the delete action.
  • when the parameter is missing because the user does not have the right to choose, the default behavior of the wiki applies (ie, sending to the recycle bin if it exists, remove permanently otherwise).