Skip to content

Commit

Permalink
Merge branch 'trunk' into fix/settings-newsletter-1023-disabled-conne…
Browse files Browse the repository at this point in the history
…ction
  • Loading branch information
grzegorz-cp committed Oct 6, 2024
2 parents a86d76f + 8a5b2e7 commit 29328c8
Show file tree
Hide file tree
Showing 35 changed files with 517 additions and 166 deletions.
Binary file modified .github/files/e2e-tests/notification-rules.enc
Binary file not shown.
105 changes: 64 additions & 41 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: fixed

Social: Fixed share status tooltip text overflow
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ export function ShareStatusLabel( { status, message } ) {
title={ __( 'Sharing failed with the following message:', 'jetpack' ) }
className={ styles[ 'share-status-icon-tooltip' ] }
>
<Text variant="body-small">{ message }</Text>
<Text variant="body-small" className={ styles[ 'tooltip-text' ] }>
{ message }
</Text>
</IconTooltip>
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@
}
}

.tooltip-text {
word-break: break-word;
}

.share-status-icon {
fill: var(--jp-green-50);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: minor
Type: added

Added a public method to check if a URL is CDN url
29 changes: 23 additions & 6 deletions projects/packages/image-cdn/src/class-image-cdn-core.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,17 +156,12 @@ public static function cdn_url( $image_url, $args = array(), $scheme = null ) {
}
}

/** This filter is documented below. */
$custom_photon_url = apply_filters( 'jetpack_photon_domain', '', $image_url );
$custom_photon_url = esc_url( $custom_photon_url );

// You can't run a Photon URL through Photon again because query strings are stripped.
// So if the image is already a Photon URL, append the new arguments to the existing URL.
// Alternately, if it's a *.files.wordpress.com url or an image on a private WordPress.com Simple site,
// then keep the domain as is.
if (
in_array( $image_url_parts['host'], array( 'i0.wp.com', 'i1.wp.com', 'i2.wp.com' ), true )
|| wp_parse_url( $custom_photon_url, PHP_URL_HOST ) === $image_url_parts['host']
self::is_cdn_url( $image_url )
|| $is_wpcom_image
|| $is_wpcom_private_site
) {
Expand Down Expand Up @@ -245,6 +240,28 @@ public static function cdn_url( $image_url, $args = array(), $scheme = null ) {
return self::cdn_url_scheme( $photon_url, $scheme );
}

/**
* Checks if a given URL is a Photon URL.
*
* @since $$next-version$$
* @param string $url The URL to check.
* @return bool True if the URL is a Photon URL, false otherwise.
*/
public static function is_cdn_url( $url ) {
$parsed_url = wp_parse_url( $url );

if ( ! $parsed_url ) {
return false;
}

// See usage in ::cdn_url for documentation of this filter
$custom_photon_url = apply_filters( 'jetpack_photon_domain', '', $url );
$custom_photon_url = esc_url( $custom_photon_url );

return in_array( $parsed_url['host'], array( 'i0.wp.com', 'i1.wp.com', 'i2.wp.com' ), true )
|| wp_parse_url( $custom_photon_url, PHP_URL_HOST ) === $parsed_url['host'];
}

/**
* Parses WP.com-hosted image args to replicate the crop.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,24 @@ public function test_photon_url_filter_network_path_photonized_to_https() {
$this->assertEquals( 'https://photon.test/example.com/img.jpg', $url );
}

/**
* @covers ::Image_CDN_Core::is_cdn_url
* @since $$next-version$$
* @group jetpack_photon_filter_network_path
*/
public function test_is_cdn_url_method() {
$this->apply_custom_domain( '//photon.test' );
$this->assertTrue( Image_CDN_Core::is_cdn_url( '//photon.test/example.com/img.jpg' ) );

$this->assertTrue( Image_CDN_Core::is_cdn_url( 'https://i0.wp.com/example.com/img.jpg' ) );
$this->assertTrue( Image_CDN_Core::is_cdn_url( 'http://i1.wp.com/example.com/img.jpg' ) );
$this->assertTrue( Image_CDN_Core::is_cdn_url( '//i2.wp.com/example.com/img.jpg' ) );
$this->assertFalse( Image_CDN_Core::is_cdn_url( '//i3.wp.com/example.com/img.jpg' ) );
$this->assertFalse( Image_CDN_Core::is_cdn_url( 'http://example.com/img.jpg' ) );
$this->assertFalse( Image_CDN_Core::is_cdn_url( 'https://example.com/img.jpg' ) );
$this->assertFalse( Image_CDN_Core::is_cdn_url( '//example.com/img.jpg' ) );
}

/**
* @author aduth
* @covers ::Image_CDN_Core::cdn_url_scheme
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: fixed

profile.php: Make wpcom links more concise
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: changed

Updated package dependencies.
2 changes: 1 addition & 1 deletion projects/packages/jetpack-mu-wpcom/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"@automattic/typography": "1.0.0",
"@popperjs/core": "^2.11.8",
"@preact/signals": "^1.2.2",
"@sentry/browser": "7.80.1",
"@sentry/browser": "8.33.0",
"@tanstack/react-query": "^5.15.5",
"@wordpress/api-fetch": "7.8.2",
"@wordpress/base-styles": "5.8.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,19 +41,27 @@ function wpcom_profile_settings_add_links_to_wpcom() {
array(
'language' => array(
'link' => esc_url( 'https://wordpress.com/me/account' ),
'text' => __( 'Your admin interface language is managed on WordPress.com Account settings', 'jetpack-mu-wpcom' ),
'text' => __( 'Manage your WordPress.com account language ↗', 'jetpack-mu-wpcom' ),
),
'synced' => array(
'name' => array(
'link' => esc_url( 'https://wordpress.com/me' ),
'text' => __( 'You can manage your profile on WordPress.com Profile settings (First / Last / Display Names, Website, and Biographical Info)', 'jetpack-mu-wpcom' ),
'text' => __( 'Manage your WordPress.com profile ↗', 'jetpack-mu-wpcom' ),
),
'website' => array(
'link' => esc_url( 'https://wordpress.com/me' ),
'text' => __( 'Manage your WordPress.com profile website ↗', 'jetpack-mu-wpcom' ),
),
'bio' => array(
'link' => esc_url( 'https://wordpress.com/me' ),
'text' => __( 'Manage your WordPress.com profile bio ↗', 'jetpack-mu-wpcom' ),
),
'email' => array(
'link' => esc_url( 'https://wordpress.com/me/account' ),
'text' => __( 'Your WordPress.com email is managed on WordPress.com Account settings', 'jetpack-mu-wpcom' ),
'text' => __( 'Manage your WordPress.com account email ↗', 'jetpack-mu-wpcom' ),
),
'password' => array(
'link' => esc_url( 'https://wordpress.com/me/security' ),
'text' => __( 'Your WordPress.com password is managed on WordPress.com Security settings', 'jetpack-mu-wpcom' ),
'text' => __( 'Manage your WordPress.com password ', 'jetpack-mu-wpcom' ),
),
'isWpcomAtomicClassic' => $is_wpcom_atomic_classic,
)
Expand Down
Loading

0 comments on commit 29328c8

Please sign in to comment.