After installing project-HEAD and project_issue-HEAD a new "issue" content type is created. Attempting to create a issue without the project name argument causes a HTTP 302 which will eventually time out and display a "Redirect Loop" message in firefox.
Verified this is not the case on d.o, which correctly returns a form to select from a list of projects.
| Comment | File | Size | Author |
|---|---|---|---|
| #13 | 575206-13.issue_add_redirect_one_project.patch | 1.66 KB | dww |
| #3 | pi-575206-infinit-loop-v1.patch | 1023 bytes | kars-t |
Comments
Comment #1
kars-t commentedI can verify this issue and I can't get the creation of issue nodes to work.
Comment #2
kars-t commentedFound it:
issue_node_form.onc line 41
print_r($projects)
"Drupal Site" is the projecttype from the taxonomy and the key is not directly key($projects) but key($projects['Drupal Site'])
Today I don't have enough time to make a patch so probably tomorrow :)
Comment #3
kars-t commentedA patch for this.
project_projects_select_options sadly gives us a different structured array if there is a term set in the projecttypes vocabulary. If we just use the key we get the name of this term. So we have to use the key of the current item wich is an array.
Comment #4
zoltán balogh commentedPatch in #3 works fine.
Comment #5
nicoloconte commentedWorks fine #3 but now I'm not able to select the project for the issue!
Comment #6
kars-t commented@nicoloconte
Do you have more than one project? Because that should be the only way you could enter the code from the patch?
Comment #7
evoltech commented#3 just takes the first issue in the list and attempts to add an issue for it. I think a better solution is what the d.o version does: giving you a list of projects, which seem to be independent of available "projects" as in modules or themes.
Comment #8
nicoloconte commentedYes I have some different project (approximately 10).
Comment #9
dwwThis code was added by #526438: Skip project selection if user has access to only one project. We just want to make sure that fixing this bug doesn't re-break that feature... Don't have time right this second to setup a test site for this (since the d.o testing install profile populates the project taxonomy in a way that this bug wouldn't show up), but I'll try to get to it in the next few days if possible, maybe later this evening...
Comment #10
kars-t commented@dww
As far as I have tested the code should behave exactly like you intended to but be more robust and handle both return values from project_projects_select_options. Maybe there should be a check if the int we get really is a project node. I don't know if an added node_load is a good solution to check this or just wasted performance.
But I have to conform the behaviour nicoloconte has on my own site. So I set this to needs work again. I probably be able to put in some more work into this later this week. And if I find some time I'd love to add a test for this.
Comment #11
kars-t commentedOkay its obvious why this doesn't work now:
Again project_projects_select_options gives a us a multi dimensional array like
So count of this array will always be 1 if there are no projects of different types. My patch always uses the first project from the projecttype array. Bad thing this way.
Quick Fix patch later:
This works but I don't know if its the best stile and it still has a problem.
As PHP lacks an array_depth() funktion I use COUNT_RECURSIVE to check. But there could be two projects as well. I will think about this.
Comment #12
dwwI have a real solution to this, I just have to run to class right now. I'll post a patch later... Stay tuned.
Comment #13
dwwRight, the array we get back from project_projects_select_options() is complicated, since it can be either a flat array of nid => title options, or it can be a nested array of project types, with nid => title mappings in each subarray (if the project taxonomy is defined). It's kind of painful, in that circumstance, to figure out if there's only one project that the user has access to. :(
However, the good news is that if you pass a reference to an array as the first argument to project_projects_select_options(), it populates that array with all the project shortname => nid mappings in a flat, 1-dimensional array. That's perfect for two reasons: a) we can safely just count() that, regardless of the project type taxonomy and get a real value, and b) since we already have the short name, so we don't even need to do the node_load() to create the URL we want to redirect to. ;)
So, new patch that takes advantage of all this, and also includes better code comments. Tested locally in a bunch of different cases and it's all working properly now. Anyone else want to give this a test drive before I commit?
Thanks,
-Derek
Comment #14
nicoloconte commentedIn my case it works great!!
Comment #15
dwwCommitted #13 to HEAD.
Comment #16
kars-t commentedGreat and many thanks! :D
Comment #18
xaa commentedhi, I have this problem with the project-isssue alpha5 & vertical-tabs rc2.
Is there another fix ?
thanks