Opened 7 years ago
Closed 7 years ago
#42686 closed defect (bug) (fixed)
Default selected changeset status should not be publish when current user does not have publish capability
Reported by: | sayedwp | Owned by: | westonruter |
---|---|---|---|
Milestone: | 4.9.3 | Priority: | normal |
Severity: | normal | Version: | 4.9 |
Component: | Customize | Keywords: | has-patch fixed-major commit |
Focuses: | javascript | Cc: |
Description
The default state of wp.customize.state( 'selectedChangesetStatus' )
is set to publish
even when the user does not have the publish capability. And its value is changed to draft
if wp.customize.settings.changeset.currentUserCanPublish
is false
and the state changes.
This would work fine if there is no extra status added by a plugin. However if a plugin tries to add status like pending
and user clicks on it, it would create issues because the selectedChangesetStatus
is forced to stay draft
. See issue https://github.com/xwp/wp-customize-snapshots/issues/167
Attachments (2)
Change History (12)
#3
@
7 years ago
- Keywords has-patch added; needs-patch removed
- Owner set to westonruter
- Status changed from new to accepted
This ticket was mentioned in Slack in #core-customize by westonruter. View the logs.
7 years ago
This ticket was mentioned in Slack in #core by desrosj. View the logs.
7 years ago
#7
@
7 years ago
@sayedwp one tweak I have for the patch:
-
src/wp-admin/js/customize-controls.js
7938 7938 } else { 7939 7939 saveBtn.val( api.l10n.schedule ); 7940 7940 } 7941 } else {7941 } else if ( api.settings.changeset.currentUserCanPublish ) { 7942 7942 saveBtn.val( api.l10n.publish ); 7943 7943 } 7944 7944 closeBtn.find( '.screen-reader-text' ).text( api.l10n.cancel );
It doesn't seem to change the end result, at least with Customize Snapshots active, but it would seem that we should only be setting the saveBtn
's label to publish if the user can indeed publish.
Bumping to 4.9.3 due to 4.9.2s release