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

Disable Story posts when Jetpack features are removed #19823

Merged
merged 6 commits into from
Jan 4, 2023

Conversation

fluiddot
Copy link
Contributor

@fluiddot fluiddot commented Dec 30, 2022

Disables the option to create a Story post when the Jetpack-powered features are removed.

Ref: pe7hp4-4k-p2

To test:

1 - Story post ENABLED in WordPress app

  1. Navigate to App Settings in the WordPress app and open Debug settings.
  2. Turn Jetpack Features Removal Phase Four and Jetpack Features Removal Phase For New Users flags off.
  3. Navigate to My Site screen.
  4. Tap on the floating button located in the low-right corner.
  5. Observe that the Story post option is displayed.
  6. Navigate to the Posts list screen
  7. Tap on the floating button located in the low-right corner.
  8. Observe that the Story post option is displayed.

2 - Story post DISABLED in WordPress app

  1. Navigate to App Settings in the WordPress app and open Debug settings.
  2. Turn Jetpack Features Removal Phase Four flag on.

NOTE: It's recommended that the following steps are also checked by turning the Jetpack Features Removal Phase For New Users flag on and Jetpack Features Removal Phase Four flag off in Debug settings.

  1. Navigate to My Site screen.
    NOTE: If you were on the My Site screen when changing the flags, you might need to navigate to a different tab and back again to My Site to see the changes reflected.
  2. Tap on the floating button located in the low-right corner.
  3. Observe that the Story post option is NOT displayed.
  4. Navigate to the Posts list screen
  5. Tap on the floating button located in the low-right corner.
  6. Observe that no option is displayed and that the editor is opened.

3- Story post is ENABLED in Jetpack app

  1. Navigate to App Settings in the Jetpack app and open Debug settings.
  2. Turn Jetpack Features Removal Phase Four flag on. This flag should be omitted by the Jetpack app.
  3. Navigate to My Site screen.
  4. Tap on the floating button located in the low-right corner.
  5. Observe that the Story post option is displayed.
  6. Navigate to the Posts list screen
  7. Tap on the floating button located in the low-right corner.
  8. Observe that the Story post option is displayed.

Regression Notes

  1. Potential unintended areas of impact
    The changes should only impact the floating Create button located on My Site and Posts list screens.

  2. What I did to test those areas of impact (or what existing automated tests I relied on)
    N/A

  3. What automated tests I added (or what prevented me from doing so)
    N/A

PR submission checklist:

  • I have completed the Regression Notes.
  • I have considered adding unit tests for my changes.
  • I have considered adding accessibility improvements for my changes.
  • I have considered if this change warrants user-facing release notes and have added them to RELEASE-NOTES.txt if necessary.

@fluiddot fluiddot added this to the 21.5 milestone Dec 30, 2022
@fluiddot fluiddot self-assigned this Dec 30, 2022
Comment on lines 79 to 81
static func shouldBeShown(blog: Blog?) -> Bool {
return (blog?.supports(.stories) ?? false) && !UIDevice.isPad() && !JetpackFeaturesRemovalCoordinator.shouldRemoveJetpackFeatures()
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I noticed that we weren't using the same conditions for determining if the Story Post action should be shown in different places. For this reason, I decided to unify the logic into a single function. Specifically, checking if the device is an iPad. Based on this PR and this Kanvas issue, I understand that the Story post shouldn't be enabled on iPad.

@wpmobilebot
Copy link
Contributor

wpmobilebot commented Dec 30, 2022

You can test the changes in Jetpack from this Pull Request by:
  • Clicking here or scanning the QR code below to access App Center
  • Then installing the build number pr19823-b156b82 on your iPhone

If you need access to App Center, please ask a maintainer to add you.

@wpmobilebot
Copy link
Contributor

wpmobilebot commented Dec 30, 2022

You can test the changes in WordPress from this Pull Request by:
  • Clicking here or scanning the QR code below to access App Center
  • Then installing the build number pr19823-b156b82 on your iPhone

If you need access to App Center, please ask a maintainer to add you.

@fluiddot fluiddot force-pushed the disable-jp-features-story-posts branch from ac08a81 to 6197b2b Compare January 2, 2023 13:27
@@ -691,7 +691,8 @@ - (BOOL)supportsPluginManagement
- (BOOL)supportsStories
{
BOOL hasRequiredJetpack = [self hasRequiredJetpackVersion:@"9.1"];
return hasRequiredJetpack || self.isHostedAtWPcom;
// Stories are disabled in iPad until this Kanvas issue is solved: https://github.com/tumblr/kanvas-ios/issues/104
return (hasRequiredJetpack || self.isHostedAtWPcom) && ![UIDevice isPad] && ![JetpackFeaturesRemovalCoordinator shouldRemoveJetpackFeatures];
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I noticed that we weren't using the same conditions for determining if the Story Post action should be shown in different places. For this reason, I decided to unify the logic into a single function. Specifically, checking if the device is an iPad. Based on this PR and this Kanvas issue, I understand that the Story post shouldn't be enabled on iPad.

@@ -691,7 +691,8 @@ - (BOOL)supportsPluginManagement
- (BOOL)supportsStories
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I originally considered checking the isPad and feature removal conditions in a specific helper within the StoryAction class. But I finally ended up using the supports functionality of the Blog model as the logic seemed closer to me. In any case, please let me know if there's a better approach for this, thanks!

@fluiddot fluiddot marked this pull request as ready for review January 2, 2023 16:03
@hassaanelgarem hassaanelgarem self-requested a review January 2, 2023 21:18
Copy link
Contributor

@hassaanelgarem hassaanelgarem left a comment

Choose a reason for hiding this comment

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

Works as described! 🚀

@fluiddot fluiddot merged commit cb040ad into trunk Jan 4, 2023
@fluiddot fluiddot deleted the disable-jp-features-story-posts branch January 4, 2023 14:19
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.

3 participants