I am having a problem a) being able to update the path of a revision and/or being able to update them at the right time in the workflow. There are two workflows I've defined. Both are illustrated in my screencast.

https://dl.dropbox.com/u/4770698/Drupal-org/Workbench%20Moderation%20URL...

First workflow, using custom URL alias

  1. Create new node and, before saving for the first time, uncheck "Generate automatic URL alias" and enter a custom URL alias value.
  2. Save the node.
  3. If you try to access the node at the URL alias you've defined as an anonymous, you will get a "not found" error. This is right because the node is still in Draft.
  4. Change the node Published and now you can access the node at the URL alias was defined. Everything is fine to this point.
  5. Click on New Draft, change the URL alias and then save
  6. Click on View Published and you will see that the path is now the new path even though this version is still a Draft.
  7. If I go to the old path, I am redirected to the new path due to the Redirect module.

Second workflow, using Pathauto

  1. Create new node and, before saving for the first time, be sure that "Generate automatic URL alias" is checked. (Note that the path pattern for this node is simply the node title.)
  2. Save the node.
  3. If you try to access the node at the URL alias you've defined as an anonymous, you will get a "not found" error. This is right because the node is still in Draft.
  4. Change the node Published and now you can access the node at the URL alias was defined. Everything is fine to this point.
  5. Click on New Draft, change the title and then Save
  6. Click on View Published and you will see that the path is still the published version of the node which is right because the new version is still a Draft.
  7. Publish the draft and then access the old path and you'll be redirected to the new path (due to Redirect module). All is perfect up to this point.
  8. Click on New Draft and then uncheck "Generate automatic URL alias" and enter a custom URL alias value.
  9. Click on Save
  10. Reload the node in view mode and the path has not changed which is right because the new path is still in Draft mode.
  11. Publish the Draft and then click on View Published and you'll notice that the old path is still active. The new path does not take over as expected.
  12. Click on New Draft and you'll see your new path is defined as the URL alias-- so why isn't it accessible from that path?
  13. Note that if I access the new path, it refers me to the old path.

I am operating as user1

Modules that I have installed that might affect the outcome:
Workbench 7.x-1.1+7-dev
Workbench Moderation 7.x-1.2+13-dev
Redirect
Pathauto
Pathauto persistent state

Related cases:
#1087044: Custom URL path settings do not survive moderation
#1273408: Workbench looses path aliases
#1852244: Setting path to default Pathauto value

Comments

bbinkovitz’s picture

Status: Needs review » Active

I tried the same steps with slightly different results.

Dramatis Personae:

  • User 1: has role 'administrator', can do anything.
  • User 0: has role 'anonymous user', can view published content.
  • Node: of a type that has moderation enabled and default state of unpublished.

Act 1: With Pathauto

(the scene: site "mysite.com" with workbench, workbench moderation, and pathauto enabled with default pattern of "/content/[title]")

  1. User 1 creates a new Node with title "title" and, before saving for the first time, enters a custom URL alias value, 'alias', then saves Node.
  2. User 0 navigates to "mysite.com/alias" but is rightly foiled by a Drupal 403 because Node is still in Draft.
  3. User 1 moderates the Node to Published.
  4. User 0 once again navigates to "mysite.com/alias" only to be confounded by a Drupal 404.
  5. User 1 navigates to "mysite.com/alias" and is confounded by the very same Drupal 404!
  6. Users 1 and 0 both navigate to "mysite.com/content/title", whereupon they both find the evasive Node.
  7. Therein lies a bug!
  8. Fin.

Act 2: Without Pathauto

(the scene: site "mysite.com" with workbench, workbench moderation, and path but not pathauto enabled.)

  1. User 1 creates a new Node with title "title" and, before saving for the first time, enters a custom URL alias value, 'alias', then saves Node.
  2. User 0 navigates to "mysite.com/alias" but is rightly foiled by a Drupal 403 because Node is still in Draft.
  3. User 1 moderates the Node to Published.
  4. Users 1 and 0 both navigate to "mysite.com/alias", whereupon they both find Node.
  5. User 1 creates a new Draft with the custom alias of "foo".
  6. Users 0 and 1 navigate to "mysite.com/alias" and are rightly foiled by a Drupal 404. Both users flee to "mysite.com/foo" whereupon Node is found. (published state)
  7. Therein lies no bug!
  8. Fin.
bbinkovitz’s picture

Status: Active » Needs review
StatusFileSize
new1.51 KB

I tried to write a failing test for your second scenario but I either misunderstood the problem or I am just not able to reproduce it. Attached is a patch consisting of a couple of tests only. They all pass on my sandbox, but I am curious to see what they do on the testbot.

capellic’s picture

The only reason that our "Using custom URL alias" results are different is because I'm using the URL redirect module (admin/config/search/redirect/settings) to avoid a user from hitting a 404 error when visiting an old alias. I have "Automatically create redirects when URL aliases are changed." checked in the settings for that module.

Looks like your tests passed. What's next?

As for my 2nd workflow, "Using Pathauto," I went through the steps again to see if I could still reproduce. I am still able to reproduce the error as defined at step 11. What's interesting is that this seems to be the opposite problem as what's happening in workflow 1. I noticed that you didn't record your steps for the workflow #2, is to possible you missed a step?

bbinkovitz’s picture

I am able to reproduce manually as well. I'm struggling to write tests that reproduce the problem, however, because of the vagaries of the DrupalWebTestCase functions and other testing woes, such as #1903740: drupal_lookup_path() breaks when called from within a simpletest..

bbinkovitz’s picture

Status: Active » Needs review
StatusFileSize
new5.22 KB

There is a plot twist! When attempting to duplicate Act 2 in a test rather than in the GUI, there are unexpected failures. Tests attached. Please note that when these steps are carried out manually, there are no failures. The failures only happen in simpletest, but the bug is in Workbench Moderation.

bbinkovitz’s picture

Status: Needs review » Needs work

... That shouldn't have passed. WTF.

hass’s picture

Priority: Normal » Critical

I've tried to disable redirect module, but it's still not possible to set a custom url alias :-(((

Critical, as I'm not able to organize a structure in a menu (local tabs need this /foo/bar1, /foo/bar2).

aschiwi’s picture

There's proposed temporary fix with a custom module in a duplicate issue of this: https://drupal.org/node/1945558#comment-7500630 Leaving this here for anyone who needs it.

danny_joris’s picture

Aside from tests, has the issue been traced in the code yet? While profiling I did see that the published node version got loaded and saved again while saving a draft. Probably something going wrong there. Let me know who I can help.

danny_joris’s picture

Issue summary: View changes

Links

rafalenden’s picture

I've created module that adds versioning for path: Workbench Path Revision.

seemas’s picture

What about Drupal 8?