Download & Extend

Adding an empty node deletes first item in queue

Project:Nodequeue
Version:6.x-2.4
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

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.

AttachmentSizeStatusTest resultOperations
nodequeue_adding_empty_node_does_no_delete.patch592 bytesIgnored: Check issue status.NoneNone

Comments

#1

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.

AttachmentSizeStatusTest resultOperations
593858.patch1.82 KBIgnored: Check issue status.NoneNone

#2

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

#3

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.

AttachmentSizeStatusTest resultOperations
593858-1.patch4.13 KBIgnored: Check issue status.NoneNone

#4

Status:needs review» fixed

This is applied. Thanks again for pointing this out.

#5

Status:fixed» closed (fixed)

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

nobody click here