[wp-trac] [WordPress Trac] #18642: _edit_lock timestamp does not update on autosave() of non-changed, non-draft posts
WordPress Trac
wp-trac at lists.automattic.com
Sun Sep 11 20:47:38 UTC 2011
#18642: _edit_lock timestamp does not update on autosave() of non-changed, non-
draft posts
-----------------------------------+------------------
Reporter: benbalter | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: 3.3
Component: Autosave | Version: 3.3
Severity: minor | Resolution:
Keywords: 2nd-opinion has-patch |
-----------------------------------+------------------
Old description:
> Admin_ajax does not properly update the _edit_lock timestamp in posts
> when:
>
> 1. The post->post_status != draft, and
> 1. The content of the post has not changed since the last autosave ping
>
> '''STR:'''
>
> 1. Open up a post, page, or CPT that's either private or published
> 1. (wait 2 minutes or 2x your autosave ping, don't make any changes to
> the content)
> 1. Log in as another user and navigate to the post
> 1. User # 2 now has the file lock because User # 1's timestamp has
> expired
>
> '''The Problem:'''
>
> Lines 282 - 283 of autosave.dev.js (trunk) only POSTs auto_draft if it is
> "1".
>
> Lines 985 - 992 expect non-auto_draft autosaves to post auto_draft as !=
> 1.
>
> Possibly Helpful for Background: r12991
>
> '''So three possible scenarios:'''
>
> 1. Initial autodraft, auto_draft is posted as 1, line 992 updates
> _edit_post
> 1. Post content has changed, it's a true autosave, so _edit_lock gets
> update through edit_post()
> 1. Post content has not changed, it's not an autodraft, so auto_draft is
> not POSTed, and the lock is never updated.
>
> ''Auto_draft will always either be 1 (and thus ID ='s 0) or not POST'd at
> all. Admin Ajax erroneously assumes it will be posted as != 1 when not an
> autodraft.''
>
> '''Proposed Fix:'''
>
> If auto_draft is not set, update post lock. (patch attached).
>
> Alternatively, could patch autosave.js to pass auto_draft of 1 on every
> non-auto_draft call.
>
> (tested against trunk)
New description:
Admin_ajax does not properly update the _edit_lock timestamp in posts
when:
1. The post->post_status != draft, and
1. The content of the post has not changed since the last autosave ping
'''STR:'''
1. Open up a post, page, or CPT that's either private or published
1. (wait 2 minutes or 2x your autosave ping, don't make any changes to the
content)
1. Log in as another user and navigate to the post
1. User # 2 now has the file lock because User # 1's timestamp has expired
'''The Problem:'''
Lines 282 - 283 of autosave.dev.js (trunk) only POSTs auto_draft if it is
"1".
Lines 985 - 992 expect non-auto_draft autosaves to post auto_draft as !=
1.
Possibly Helpful for Background: r12991
'''So three possible scenarios:'''
1. Initial autodraft, auto_draft is posted as 1, line 992 updates
_edit_post
1. Post content has changed, it's a true autosave, so _edit_lock gets
update through edit_post()
1. Post content has not changed, it's not an autodraft, so auto_draft is
not POSTed, and the lock is never updated.
''Auto_draft will always either be 1 (and thus ID ='s 0) or not POST'd at
all. Admin Ajax erroneously assumes it will be posted as != 1 when not an
autodraft.''
'''Proposed Fix:'''
If auto_draft is not set, update post lock. (patch attached).
Alternatively, could patch autosave.js to pass auto_draft of 0 on every
non-auto_draft call.
(tested against trunk)
--
Comment (by duck_):
Typo fix on behalf of Ben.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/18642#comment:2>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list