Closed (outdated)
Project:
Drupal core
Version:
6.x-dev
Component:
node system
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
20 Oct 2009 at 04:37 UTC
Updated:
2 Mar 2016 at 22:18 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
bleen commentedsubscribe
Comment #2
bleen commentedThis patch should do it ... please to review
Comment #3
redndahead commentedI can verify that this fixes this issue. It can be committed, but we'll need tests in that area.
Comment #4
jim0203 commentedGood work at fixing the problem, but I think it would be good if we gave the user some feedback rather than just dumping them back where they started.
I have, therefore, added a couple of lines to the patch which display a warning message that "No nodes were selected" and then returns - if the return line is removed then node_mass_update() is called, which itself displays a message saying that nodes have been updated - thus contradicting themessage I have added.
Comment #5
jim0203 commentedSorry, the tabs weren't right in that code. Fixed here.
Comment #6
bleen commentedI confirm that jim0203's patch (a) works and (b) is more user friendly than the one I posted above...
The white space was a bit weird (this patch fixes it) ... but other than that, its good to go ...
Comment #7
bleen commentedforgot to change "status".
Comment #8
redndahead commentedI think I would like to see it more like:
Seems a little cleaner to me.
This review is powered by Dreditor.
Comment #9
bleen commented@redndahead ... an excellent suggestion. see patch
Comment #10
redndahead commentedsorry I'm not throwing up a patch, but documentation needs some work.
Comment #11
jim0203 commentedNew patch, incorporating suggestions in #10
Comment #12
redndahead commentedMinor Cleanup of white space and adding a period to the comment.
Comment #14
redndahead commentedLet's try this
Comment #15
redndahead commentedStupid white space again.
Comment #16
bleen commented**IGNORE THIS** ... I hadn't refreshed the page and seen that someone else already submitted a patch that passed
Comment #17
bleen commentedI've tested "empty_update-609152-6.patch" and it works fine ... I think we are ready to go.
Comment #18
webchickMinor nit-pick. We don't say "node" anywhere in user-facing text. It should be 'content' instead. Feel free to mark back to RTBC when this is fixed.
Comment #19
redndahead commentedThere ya go
Comment #20
webchickHmmm. And now that I look at this again, let's actually move this new logic up to the very top of the function. There's no point in invoking node_operations hooks if they didn't select any content.
This review is powered by Dreditor.
Comment #21
redndahead commentedSeek and ye shall find.
Comment #22
webchickHm. And in looking at this /again/ there's something else funny going on here.
a) We should not be doing checks like this in a submit handler. Submit handlers should be able to assume that everything's hunky-dory.
b) Where this kind of logic belongs is in the validate handler for a form.
c) However, there already /is/ a validate handler in the form, which is basically doing exactly this:
So the real problem is figuring out why that code isn't firing.
Comment #23
redndahead commentedI can verify that node_admin_nodes_validate doesn't seem to get called. Also It seems the params in that function are wrong. It should be
If we could get it to call node_admin_nodes_validate it would balk at the array_filter() call. So once we can get node_admin_nodes_validate called we should move the last patch as the method used in that function.
Comment #24
redndahead commentedUgh forget most of my last post. I am too tired to be making comments.
Comment #25
redndahead commentedHere is a fixed patch. The validate function was named wrong. Plus it needed to check to see if $form_state['values']['nodes'] is an array.
Comment #27
redndahead commentedNeeded to only validate if we click update.
Comment #28
webchickUpdate from IRC:
The problem with code like this is that it doesn't work when my site is in French, and 'Update' becomes 'Réviser' or whatever.
While wrapping 'Update' in t() can mitigate that, this also breaks if a front-end developer decides to go in and form_alter() it to a different label altogether, not going through the translation system.
A better way to go would be to attach the validate handler to the button itself. I looked around in core briefly for an example and didn't find one, but basically it would entail:
Also, since this has to be the biggest disparity severity of problem : back-and-forth to fix it ratio I've seen on an issue in a long time, I think we officially need some tests for this so we don't ever break it again. :)
This review is powered by Dreditor.
Comment #29
redndahead commentedIncorporated webchick's irc suggestions. And now with a new test.
Comment #30
redndahead commentedAnd of course white space.
Comment #31
webchickOk! Last (hopefully) things to change. :) Great job on the perseverance here!
1. Let's condense these two things down to one check. In other words:
if (!is_array(..) || count(...) == 0) {
...
}
2. Don't return; here. We want all of the validation routines to fire. Errors are accumulated in form_set_error().
This is good, and checks for the situation where there are no nodes to select. We should also check for the condition where there ARE nodes but none are selected.
I'm on crack. Are you, too?
Comment #32
redndahead commentedHere's the fixes.
Comment #33
redndahead commented*grumble* white space *grumble*
Comment #34
webchickBy jove, I think you've got it! :) I can officially find nothing else to complain about now, so committed to HEAD!
Great work! :D
Comment #35
redndahead commentedHere is a d6 patch. It seems it passes an array ok in d6 so no need to check if it's an array.
Comment #36
redndahead commentedBehavior is different in d6.
1) Install fresh d6
2) go to admin/content
3) click update
It should say it was updated successfully. It should say that no items were selected.
Comment #37
bleen commented#35 works in Drupal 6.15
Comment #38
dpearcefl commentedHas this been fixed in the latest D6?
Comment #39
bleen commentednope
Comment #40
dpearcefl commentedIf #35 works with D6, can you please post a copy of the patch under 6.x-dev?
Comment #41
bleen commentedrerolled #35 using git
Comment #42
dpearcefl commentedSorry bleen18, your patch was ignored because of the filename I think. Try this format:
[description]-[issue-number]-[comment-number].patch
from http://drupal.org/node/1054616
Try resubmitting the patch and changing the status back to "needs review".
Comment #43
bleen commentedComment #44
redndahead commentedD6 patches don't go through the testing. That's why it was ignored.
Comment #45
redndahead commentedBy the way the patch looks good as far as the git version matching the cvs version. Since it's still somewhat my own patch I can't RTBC. Can someone else look at this to RTBC?