Make WordPress Core


Ignore:
Timestamp:
10/12/2017 04:00:15 AM (7 years ago)
Author:
westonruter
Message:

Customize: Add changeset locking in Customizer to prevent users from overriding each other's changes.

  • Customization locking is checked when changesets are saved and when heartbeat ticks.
  • Lock is lifted immediately upon a user closing the Customizer.
  • Heartbeat is introduced into Customizer.
  • Changes made to user after it was locked by another user are stored as an autosave revision for restoration.
  • Lock notification displays link to preview the other user's changes on the frontend.
  • A user loading a locked Customizer changeset will be presented with an option to take over.
  • Autosave revisions attached to a published changeset are converted into auto-drafts so that they will be presented to users for restoration.
  • Focus constraining is improved in overlay notifications.
  • Escape key is stopped from propagating in overlay notifications, and it dismisses dismissible overlay notifications.
  • Introduces changesetLocked state which is used to disable the Save button and suppress the AYS dialog when leaving the Customizer.
  • Fixes bug where users could be presented with each other's autosave revisions.

Props sayedwp, westonruter, melchoyce.
See #31436, #31897, #39896.
Fixes #42024.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/qunit/index.html

    r41773 r41839  
    22112211        <script src="wp-includes/js/tinymce/tinymce-obsolete.js"></script>
    22122212
     2213        <!-- Changeset locked notice template -->
     2214        <script type="text/html" id="tmpl-customize-changeset-locked-notice">
     2215            <div id="customize-changeset-lock-dialog" class="notification-dialog-wrap hidden">
     2216                <div class="notification-dialog-background"></div>
     2217                <div class="notification-dialog">
     2218                    <div class="customize-changeset-locked-message">
     2219                        <div class="customize-changeset-locked-avatar"></div>
     2220                        <p class="currently-editing wp-tab-first" tabindex="0">
     2221                            <span class="customize-notice-user-name"></span> <span class="customize-take-over-message">is already customizing this site. Do you want to take over?</span></p>
     2222                        <p>
     2223                            <a class="button customize-notice-go-back-button" href="/wp-admin/post.php?post=505&#038;action=edit">Go back</a>
     2224                            <a class="button customize-notice-preview-button" href="http://example.org/?customize_changeset_uuid=7a796f7a-255c-49f5-9d25-cef0c315a4ba">Preview</a>
     2225                            <a class="button button-primary wp-tab-last customize-notice-take-over-button" href="http://example.org/wp-admin/customize.php?changeset_uuid=7a796f7a-255c-49f5-9d25-cef0c315a4ba&action=customize_take_over_changeset&nonce=e3a1df16d2&return=/wp-admin/post.php?post=505&action=edit">Take over</a>
     2226                        </p>
     2227                    </div>
     2228                </div>
     2229            </div>
     2230        </script>
     2231
    22132232        <!-- Updates templates and HTML fixtures -->
    22142233        <script id="tmpl-wp-updates-admin-notice" type="text/html">
Note: See TracChangeset for help on using the changeset viewer.