Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Social | Fix social connections list initial state feature check #41151

Draft
wants to merge 3 commits into
base: trunk
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions projects/packages/publicize/.phan/baseline.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
// PhanPossiblyUndeclaredVariable : 2 occurrences
// PhanTypeMismatchReturnProbablyReal : 2 occurrences
// PhanTypeMissingReturn : 2 occurrences
// PhanUndeclaredClassMethod : 2 occurrences
// PhanImpossibleCondition : 1 occurrence
// PhanNoopNew : 1 occurrence
// PhanParamSignatureMismatch : 1 occurrence
Expand All @@ -29,7 +28,6 @@
// PhanTypeMismatchDefault : 1 occurrence
// PhanTypeMismatchDimFetch : 1 occurrence
// PhanTypeMismatchReturn : 1 occurrence
// PhanUndeclaredFunction : 1 occurrence
// PhanUndeclaredMethod : 1 occurrence

// Currently, file_suppressions and directory_suppressions are the only supported suppressions
Expand All @@ -40,7 +38,6 @@
'src/class-publicize-ui.php' => ['PhanPluginDuplicateExpressionAssignmentOperation', 'PhanTypeMismatchReturnProbablyReal'],
'src/class-publicize.php' => ['PhanParamSignatureMismatch', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgument', 'PhanTypeMissingReturn'],
'src/class-rest-controller.php' => ['PhanPluginDuplicateConditionalNullCoalescing', 'PhanTypeMismatchReturnProbablyReal'],
'src/rest-api/class-base-controller.php' => ['PhanUndeclaredClassMethod', 'PhanUndeclaredFunction'],
'src/rest-api/class-connections-controller.php' => ['PhanPluginMixedKeyNoKey', 'PhanUndeclaredMethod'],
'src/rest-api/class-connections-post-field.php' => ['PhanPluginDuplicateConditionalNullCoalescing'],
'src/social-image-generator/class-post-settings.php' => ['PhanPluginDuplicateConditionalNullCoalescing'],
Expand Down
1 change: 1 addition & 0 deletions projects/packages/publicize/.phan/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
return make_phan_config(
dirname( __DIR__ ),
array(
'+stubs' => array( 'wpcom' ),
'parse_file_list' => array(
// Reference files to handle code checking for stuff from Jetpack-the-plugin or other in-monorepo plugins.
// Wherever feasible we should really clean up this sort of thing instead of adding stuff here.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: fixed

Social | Fix feature check for social connections list initial state
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,7 @@ public static function get_store_initial_state() {

return array(
'connectionData' => array(
// We do not have this method on WPCOM Publicize class yet.
'connections' => ! $is_wpcom ? self::publicize()->get_all_connections_for_user() : array(),
'connections' => self::has_feature_flag( 'connections-management' ) ? self::publicize()->get_all_connections_for_user() : array(),
),
'shareStatus' => $share_status,
);
Expand Down
2 changes: 0 additions & 2 deletions projects/packages/publicize/src/class-services.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,9 @@ class Services {
public static function get_all( $force_refresh = false ) {
if ( defined( 'IS_WPCOM' ) && constant( 'IS_WPCOM' ) ) {
if ( function_exists( 'require_lib' ) ) {
// @phan-suppress-next-line PhanUndeclaredFunction - phan is dumb not to see the function_exists check.
require_lib( 'external-connections' );
}

// @phan-suppress-next-line PhanUndeclaredClassMethod - We are here because we are on WPCOM.
$external_connections = \WPCOM_External_Connections::init();
$services = array_values( $external_connections->get_external_services_list( 'publicize', get_current_blog_id() ) );

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

Social | Fix publicize error in the editor due to malformed connections data
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: fixed

Fix publicize error in the editor due to malformed connections data
Loading