Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Edit guide link is broken after changing publish status #70

Closed
durden opened this issue May 6, 2016 · 2 comments
Closed

Edit guide link is broken after changing publish status #70

durden opened this issue May 6, 2016 · 2 comments
Labels

Comments

@durden
Copy link
Contributor

durden commented May 6, 2016

The /write/ url is unique in that it requires the full path to the guide including the publish_status. This means the 'edit this guide' sidebar link can point the user to a bad URL on the first load after changing the publish status. To reproduce this do the following:

  • Create new guide
  • Change publish status from 'draft' to 'in-review'
  • Now immediately click the 'edit this guide' link in the sidebar
  • This will likely fail to find your guide and load the default information in the editor.
    • There's a race condition here actually in that if the celery task to change the publish status is not done yet things will work. However, that almost never happens in practice.
@durden
Copy link
Contributor Author

durden commented May 6, 2016

It's worth noting that the api.api_save endpoint also has a similar race condition because it also requires the full guide path including the status.

@durden
Copy link
Contributor Author

durden commented May 6, 2016

Other URLs use the status as a query string argument and automatically check all possible publish_status option in an intelligent order. We should probably do the same thing for views.write and api.api_save. The idea being we just pass the stack/title pair and find the guide in it's current location, then update that.

Technically there's still a race condition if we try to save a guide while the publish status task is pending or in the process of running. However, that's much more difficult to fix so we should make the easy change first.

@durden durden added the bug label May 6, 2016
@durden durden closed this as completed in 32fdff3 May 9, 2016
durden added a commit that referenced this issue May 9, 2016
- Related to #70.
- This mostly improves the following scenario:
    - Author creates new guide
    - Author immediately moves guide to 'in-review'
    - Author notices a typo and immediately clicks 'edit this guide'
    - We might fetch the guide 'path' BEFORE we've finished moving it to
      'in-review' so we'll try to write the 'draft' path first, which could
      fail if the move finishes before they hit submit.
    - Previously author would be kicked back to the homepage.
    - Now author gets redirected back to write page, which triggers a new read
      of the guide, hopefully with the updated path.
- This doesn't completely fix the above scenario because the second save could
  still have the same problem.  However, it sends the author back to a more
  logical place.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant