Skip to content

Conversation

@gravityrail
Copy link
Contributor

Fixes #8919

Changes proposed in this Pull Request:

  • Add sharing icon in publish metabox
  • Refactor form rendering to make code easier to understand
  • Change "Show Details" and "Show" links to "Edit"
  • Renamed "Publicize" to "Social Sharing" (ooh - controversial!)
  • Change 'Hide' links to 'OK' buttons

Testing instructions:

  • Enable Publicize, ensure no connected accounts
  • Start a new post
  • Ensure styling looks consistent with other elements of the Publish metabox
  • Click "Edit" next to Social Sharing section
  • Add one or more accounts
  • Start a new post again
  • Ensure styling looks consistent with other elements of the Publish metabox

Screenshots

Not connected, closed:

not-connected-closed

Not connected, open:

not-connected-open

Connected, closed:

connected-closed

Connected, open:

connected-open

Proposed changelog entry for your changes:

Make styling of Publicize more consistent with wp-admin.

@gravityrail gravityrail requested a review from a team as a code owner March 8, 2018 01:50
@gravityrail gravityrail self-assigned this Mar 8, 2018
@gravityrail gravityrail added [Feature] Publicize Now Jetpack Social, auto-sharing [Status] Needs Review This PR is ready for review. [Status] Needs Design Review Design has been added. Needs a review! [Focus] FixTheFlows labels Mar 8, 2018
@gravityrail gravityrail added this to the 6.0 milestone Mar 8, 2018
Copy link
Contributor

@ebinnion ebinnion left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like most, if not all, of these security issues existed before this PR. But, if we're touching the code, we should probably go ahead and fix them.

?>
<div id="publicize" class="misc-pub-section misc-pub-section-last">
<span id="publicize-title">
<?php _e( 'Social Sharing:', 'jetpack' ); ?>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should escape this translation by using esc_html_e().

<?php if ( 0 < count( $services ) ) : ?>
<?php list( $publicize_form, $active ) = $this->get_metabox_form_connected( $services ); ?>
<span id="publicize-defaults"><strong><?php echo join( '</strong>, <strong>', array_map( 'esc_html', $active ) ); ?></strong></span><br />
<a href="#" id="publicize-form-edit"><?php _e( 'Edit', 'jetpack' ); ?></a>&nbsp;<a href="<?php echo admin_url( 'options-general.php?page=sharing' ); ?>" target="_blank"><?php _e( 'Settings', 'jetpack' ); ?></a><br />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should escape these translations as well with esc_html_e().

<a href="#" id="publicize-form-edit"><?php _e( 'Edit', 'jetpack' ); ?></a>&nbsp;<a href="<?php echo admin_url( 'options-general.php?page=sharing' ); ?>" target="_blank"><?php _e( 'Settings', 'jetpack' ); ?></a><br />
<?php else : ?>
<?php $publicize_form = $this->get_metabox_form_disconnected( $available_services ); ?>
<strong><?php echo __( 'Not Connected', 'jetpack' ); ?></strong>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should escape this translation as well with esc_html_e().

<?php else : ?>
<?php $publicize_form = $this->get_metabox_form_disconnected( $available_services ); ?>
<strong><?php echo __( 'Not Connected', 'jetpack' ); ?></strong>
<a href="#" id="publicize-disconnected-form-show"><?php _e( 'Edit', 'jetpack' ); ?></a><br />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here.


// If this one has already been publicized to, don't let it happen again
$disabled = '';
if ( $done )
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably use brackets for this if.

<div id="pub-connection-tests"></div>
<?php endif; ?>
<?php // #publicize-form
<a href="#" class="hide-if-no-js button" id="publicize-form-hide"><?php _e( 'OK', 'jetpack' ); ?></a>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should escape this translation with esc_html_e().

<ul class="not-connected">
<?php foreach ( $available_services as $service_name => $service ) : ?>
<li>
<a class="pub-service" data-service="<?php echo esc_attr( $service_name ); ?>" title="<?php echo esc_attr( sprintf( __( 'Connect and share your posts on %s', 'jetpack' ), $this->publicize->get_service_label( $service_name ) ) ); ?>" target="_blank" href="<?php echo $this->publicize->connect_url( $service_name ); ?>">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably esc href with esc_url().

</li>
<?php endforeach; ?>
</ul>
<a href="#" class="hide-if-no-js button" id="publicize-disconnected-form-hide"><?php _e( 'OK', 'jetpack' ); ?></a>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should escape this translation with esc_html_e().

<?php _e( 'Social Sharing:', 'jetpack' ); ?>
<?php if ( 0 < count( $services ) ) : ?>
<?php list( $publicize_form, $active ) = $this->get_metabox_form_connected( $services ); ?>
<span id="publicize-defaults"><strong><?php echo join( '</strong>, <strong>', array_map( 'esc_html', $active ) ); ?></strong></span><br />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This took me a little bit to grok. I'd probably change it to:

<span id="publicize-defaults">
	<?php foreach ( $active as $item ) : ?>
		<strong><?php echo esc_html( $item ); ?></strong>
	<?php endforeach; ?>
</span>

<?php if ( 0 < count( $services ) ) : ?>
<?php list( $publicize_form, $active ) = $this->get_metabox_form_connected( $services ); ?>
<span id="publicize-defaults"><strong><?php echo join( '</strong>, <strong>', array_map( 'esc_html', $active ) ); ?></strong></span><br />
<a href="#" id="publicize-form-edit"><?php _e( 'Edit', 'jetpack' ); ?></a>&nbsp;<a href="<?php echo admin_url( 'options-general.php?page=sharing' ); ?>" target="_blank"><?php _e( 'Settings', 'jetpack' ); ?></a><br />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, the href should be escaped with esc_url().

@beaulebens
Copy link
Member

I noticed that you've changed the label to "Social Sharing".

If we're going to change that label here (which is probably the most-interacted-with place it exists), then we probably should think about changing it throughout our UI, documentation, etc, and being sure that "Social Sharing" (vs "Automated Sharing", or anything else) is exactly what we want. cc @richardmuscat @rickybanister

It's probably best to leave it as Publicize as part of this changeset, but then that would be one more "brand name" we could get rid of out of Jetpack.

@gravityrail
Copy link
Contributor Author

@beaulebens I changed that label back
@ebinnion I think I addressed all that feedback

Thank you both!

@keoshi keoshi self-requested a review March 12, 2018 10:29
Copy link
Contributor

@keoshi keoshi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good, ship it!

@keoshi keoshi removed the [Status] Needs Design Review Design has been added. Needs a review! label Mar 12, 2018
@jeherve jeherve added [Status] Ready to Merge Go ahead, you can push that green button! and removed [Status] Needs Review This PR is ready for review. labels Mar 12, 2018
@gravityrail gravityrail dismissed ebinnion’s stale review March 12, 2018 13:29

Many things have changed :)

@gravityrail gravityrail merged commit 9f94fe9 into master Mar 12, 2018
@gravityrail gravityrail deleted the fix/publicize-style branch March 12, 2018 13:29
@ghost ghost removed the [Status] Ready to Merge Go ahead, you can push that green button! label Mar 12, 2018
@jeherve jeherve added the [Status] Needs Testing We need to add this change to the testing call for this month's release label Mar 12, 2018
oskosk added a commit that referenced this pull request Mar 23, 2018
dereksmart pushed a commit that referenced this pull request Mar 27, 2018
* Changelog 6.0: create base for changelog.

* Add #8938 to changelog

* Add #8962 to changelog

* Add #8974 to changelog

* Add #8975 to changelog

* Add #8978 to changelog

* Add #8867 to changelog

* Add #8937 to changelog

* Add #8961 to changelog

* Add #8855 to changelog

* Add #8944 to changelog

* Add #8973 to changelog

* Add #8977 to changelog

* Add #8979 to changelog

* Add #8980 to changelog

* Add #8982 to changelog

* Add #8983 to changelog

* Add #8984 to changelog

* Add #8986 to changelog

* Add #9005 to changelog

* Add #9010 to changelog

* Add #9012 to changelog

* Add #9021 to changelog

* Add #9022 to changelog

* Add #9056 to changelog

* Add #9061 to changelog

* Add #9079 to changelog

* Add #9080 to changelog

* Add #9088 to changelog

* Add #9096 to changelog

* Add #9097 to changelog

* Add #9100 to changelog

* Add #9107 to changelog

* Add #8969 to changelog

* Add #8993 to changelog

* Add #9003 to changelog

* Add #9031 to changelog

* Add #8945 to changelog

* Add #9052 to changelog

* Add #9058 to changelog

* Add #9066 to changelog

* Add #9076 to changelog

* Add #9053 to changelog

* Add #9108 to changelog

* Add #9135 to changelog

* Add #9148 to changelog

* Add #9125 to changelog

* Add #9137 to changelog

* Added testing instructions for 6.0.

* Added IS testing instructions, huge props to @tiagonoronha.

* Added #8498 to changelog.

* Added #8954 to changelog.

* Added #8985 to changelog.

* add #9027

* add #9112 to changelog

* add #9136 to changelog

* add #9102 to changelog

* add #9093 to changelog

* add #9062 to changelog

* add #9172 to changelog
@jeherve jeherve removed the [Status] Needs Testing We need to add this change to the testing call for this month's release label Apr 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Publicize: metabox is ugly/out of place

8 participants