Opened 12 years ago
Closed 11 years ago
#23665 closed enhancement (fixed)
Create one autosave per user
Reported by: | azaozz | Owned by: | nacin |
---|---|---|---|
Milestone: | 3.6 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Autosave | Keywords: | |
Focuses: | Cc: |
Description
Currently when autosaving drafts we overwrite them, when autosaving published posts, we keep one autosaved revision. This works well as long as there is only one post author.
Having per-user autosaves will affect only sites with many authors/editors. It will avoid overwriting when more than one user edits a post, provide better audit trail, and let us auto save data stored in the browser even if another user is editing at that moment.
Attachments (7)
Change History (17)
#2
@
12 years ago
In 23665-2.patch:
- Don't short-circuit
wp_get_post_revisions()
whenWP_POST_REVISIONS
is false. It is used to get the autosave(s) too. - Show the correct preview to each user when several users are editing.
23665-post-name.patch short-circuits wp_unique_post_slug()
for post revisions. Currently revisions are saved with post_name {$post->post_parent}-revision
, and autosaves: {$post->post_parent}-autosave
. When there are more than one, wp_unique-post_slug kicks in and adds -2
, -3
, etc. to the end. This is intended for post slugs and not necessary for revisions. If we remove it, or remove it only for autosaves, we can run a different query to fetch only the autosaves for a post instead of looping through all revisions as in the other patch.
#3
@
12 years ago
In 23665-3.patch:
- Update wp_ajax_autosave() removing post locks references.
- Update autosave.js removing post locks and logged out warnings.
@
12 years ago
Introduce wp_get_preview_post_url() to funnel post-preview URL handling through, and replace in all instances. Also patches _set_preview() and moves _show_post_preview() to 'set_current_user' priority 20 instead.
#8
@
11 years ago
Other than the following, I think this is fixed.
todo: Needs review. The errors generated in WP_Ajax_Response and parsed with wpAjax.parseAjaxResponse() haven't been used for years.
azaozz?
#9
@
11 years ago
Generally autosave needs a refresh/refactoring. WP_Ajax_Response and wpAjax.parseAjaxResponse() pass errors coming from WP_Error when saving a post. For autosave these used to be displayed under the editor. That was removed/hidden couple of years ago. As far as I remember the reason was that these are intermittent "dead-end" errors and the user cannot do anything to fix them. These errors used to be somewhat more common when we had negative post_id (before auto-draft was implemented).
Currently if there is error when saving the post, the message "Saving Draft..." that is shown while waiting for the autosave response, is not updated. Although this is not a regression it probably should be fixed. Instead of the "Draft saved at..." message we could show the actual error or perhaps just "Autosave error".
In 23631: