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

Fix some Pull UI errors #703

Merged
merged 2 commits into from
Jan 27, 2021
Merged

Fix some Pull UI errors #703

merged 2 commits into from
Jan 27, 2021

Conversation

dkotter
Copy link
Collaborator

@dkotter dkotter commented Jan 22, 2021

Description of the Change

As reported in #402, if a connection has no supported post types for pulling, a PHP notice is shown (if debug is turned on). Fixing this, I also realized that if a connection has no post types available, we default to still showing content from the post post type, which seems non-ideal. So this PR fixes that as well, so if there are no post types available for pulling, we show the No items found message.

Also in addition, while testing this, I was able to reproduce another PHP notice on this screen. We have a helper function to output any pull error messages and this only accounted for external connections, so when using an internal connection, a PHP notice is shown. And finally, it's possible for internal and external connections to have the same ID and the way we were storing these error messages wasn't accounting for that. So I've made a change so transient key we use now is different for both internal and external connections, to avoid any potential overlap.

Alternate Designs

None

Benefits

No more PHP notices will be shown and this fixes a few additional bugs.

Possible Drawbacks

None

Verification Process

  1. Add this filter to your current theme: add_filter( 'dt_available_pull_post_types', '__return_empty_array' );
  2. Go to the Pull screen and ensure that 1) no PHP notice is shown and 2) no posts are shown as available for pulling
  3. Remove that filter and go back to the Pull screen and ensure posts are now showing

Checklist:

  • I have read the CONTRIBUTING document.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my change.
  • All new and existing tests passed.

Applicable Issues

Fixes #402

Darin Kotter added 2 commits January 22, 2021 14:20
…ror and also ensure we don't show any content for pulling
…nnection ID that won't exist for internal connections. Fix how we store these errors, as we could have both an internal and external connection that shares an ID
Copy link
Contributor

@dinhtungdu dinhtungdu left a comment

Choose a reason for hiding this comment

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

LGTM

@jeffpaul jeffpaul added this to the 1.6.3 milestone Jan 27, 2021
@jeffpaul jeffpaul merged commit e929ef7 into develop Jan 27, 2021
@jeffpaul jeffpaul deleted the fix/pull-ui-errors branch January 27, 2021 22:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

PHP Notice: Undefined offset: 0 on pull content page
3 participants