This bug appears on the admin view page of Nodequeue.
If no node title has been entered, clicking on "Add node & save queue" can result in deleting the first item of the queue. I do not know why this does not happen every time though.

This small patch checks if the nid of the given node is null before adding a node, which seems to fix the problem.

Comments

ezra-g’s picture

StatusFileSize
new1.82 KB

Thanks for calling this to my attention. It turns out there are a few things wrong here:

Clicking the "Add node & save queue" button with no text can result in adding an value to nodequeue_nodes with a nid of 0. This value then counts against the queue's size limit, resulting in the removed node. What's more, nodequeue_check_subqueue_size() is called at the wrong point -- it should be called after we add the node and increase the subqueue size.

I plan to commit this but it would be great go get your testing on this revised patch.

ezra-g’s picture

Actually, we should also add a database update that clears invalid data from the nodequeue_nodes table.

ezra-g’s picture

StatusFileSize
new4.13 KB

This patch performs validation when the form is submitted, as well as before the values are saved to the database. The form_set_error doesn't highlight any fields, but this is significantly better than what we have now which has no validation and saves bad data to the database.

ezra-g’s picture

Status: Needs review » Fixed

This is applied. Thanks again for pointing this out.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.