Skip to content

Commit 9881de9

Browse files
authored
Merge pull request #5924 from woocommerce/feat/5910-jcp-updates
JCP: handle shop manager edge case and enable feature flag for all
2 parents d25adc1 + 27be410 commit 9881de9

File tree

4 files changed

+25
-14
lines changed

4 files changed

+25
-14
lines changed

Experiments/Experiments/DefaultFeatureFlagService.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public struct DefaultFeatureFlagService: FeatureFlagService {
2424
case .orderListFilters:
2525
return true
2626
case .jetpackConnectionPackageSupport:
27-
return buildConfig == .localDeveloper || buildConfig == .alpha
27+
return true
2828
case .orderCreation:
2929
return buildConfig == .localDeveloper || buildConfig == .alpha
3030
case .hubMenu:

RELEASE-NOTES.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
8.4
44
-----
55
- [***] In-Person Payments: Support for Stripe M2 card reader. [https://github.com/woocommerce/woocommerce-ios/pull/5844]
6+
- [***] Store admins can now access sites with plugins that have Jetpack Connection Package (e.g. WooCommerce Payments, Jetpack Backup) in the app. These sites do not require Jetpack-the-plugin to connect anymore. Store admins can still install Jetpack-the-plugin from the app through settings or a Jetpack banner. [https://github.com/woocommerce/woocommerce-ios/pull/5924]
67
- [*] Add/Edit Product screen: Fix transient product name while adding images.[https://github.com/woocommerce/woocommerce-ios/pull/5840]
78

89
8.3

Yosemite/Yosemite/Stores/AccountStore.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -140,12 +140,12 @@ private extension AccountStore {
140140
.map {
141141
(site, isWooCommerceActiveResult, wpSiteSettingsResult) -> Site in
142142
var site = site
143-
if case let .success(isWooCommerceActive) = isWooCommerceActiveResult {
144-
site = site.copy(isWooCommerceActive: isWooCommerceActive)
145-
}
146-
if case let .success(wpSiteSettings) = wpSiteSettingsResult {
147-
site = site.copy(name: wpSiteSettings.name, description: wpSiteSettings.description, url: wpSiteSettings.url)
148-
}
143+
guard case let .success(isWooCommerceActive) = isWooCommerceActiveResult,
144+
case let .success(wpSiteSettings) = wpSiteSettingsResult else {
145+
return site
146+
}
147+
site = site.copy(isWooCommerceActive: isWooCommerceActive)
148+
site = site.copy(name: wpSiteSettings.name, description: wpSiteSettings.description, url: wpSiteSettings.url)
149149
return site
150150
}.eraseToAnyPublisher()
151151
} else {

Yosemite/YosemiteTests/Stores/AccountStoreTests.swift

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -356,9 +356,9 @@ final class AccountStoreTests: XCTestCase {
356356
XCTAssertEqual(jetpackSite.siteID, siteIDOfJetpackSite)
357357
}
358358

359-
/// Verifies that `synchronizeSites` effectively persists a Jetpack Connection Package site with original metadata when WP site settings request fails.
359+
/// Verifies that `synchronizeSites` effectively persists a Jetpack Connection Package site without any changes when WP site settings request fails.
360360
///
361-
func test_synchronizeSites_persists_a_jetpack_cp_site_with_existing_metadata_when_wp_settings_request_fails() throws {
361+
func test_synchronizeSites_persists_a_jetpack_cp_site_without_any_changes_when_wp_settings_request_fails() throws {
362362
// Given
363363
let siteID = Int64(255)
364364
let remote = MockAccountRemote()
@@ -368,7 +368,8 @@ final class AccountStoreTests: XCTestCase {
368368
description: "old description",
369369
url: "oldurl",
370370
isJetpackThePluginInstalled: false,
371-
isJetpackConnected: true)
371+
isJetpackConnected: true,
372+
isWooCommerceActive: false)
372373
])
373374
remote.whenFetchingWordPressSiteSettings(siteID: siteID, thenReturn: .failure(NetworkError.timeout))
374375
remote.whenCheckingIfWooCommerceIsActive(siteID: siteID, thenReturn: .success(true))
@@ -396,17 +397,23 @@ final class AccountStoreTests: XCTestCase {
396397
XCTAssertEqual(jcpSite.name, "old name")
397398
XCTAssertEqual(jcpSite.tagline, "old description")
398399
XCTAssertEqual(jcpSite.url, "oldurl")
399-
XCTAssertTrue(jcpSite.isWooCommerceActive?.boolValue == true)
400+
XCTAssertTrue(jcpSite.isWooCommerceActive?.boolValue == false)
400401
}
401402

402-
/// Verifies that `synchronizeSites` persists a Jetpack Connection Package site with original isWooCommerceActive when WC site settings request fails.
403+
/// Verifies that `synchronizeSites` persists a Jetpack Connection Package site without any changes when WC site settings request fails.
403404
///
404-
func test_synchronizeSites_persists_a_jetpack_cp_site_without_isWooCommerceActive_change_when_wc_settings_request_fails() throws {
405+
func test_synchronizeSites_persists_a_jetpack_cp_site_without_any_changes_when_wc_settings_request_fails() throws {
405406
// Given
406407
let siteID = Int64(255)
407408
let remote = MockAccountRemote()
408409
remote.loadSitesResult = .success([
409-
Site.fake().copy(siteID: siteID, isJetpackThePluginInstalled: false, isJetpackConnected: true, isWooCommerceActive: false)
410+
Site.fake().copy(siteID: siteID,
411+
name: "old name",
412+
description: "old description",
413+
url: "oldurl",
414+
isJetpackThePluginInstalled: false,
415+
isJetpackConnected: true,
416+
isWooCommerceActive: false)
410417
])
411418
remote.whenFetchingWordPressSiteSettings(siteID: siteID, thenReturn: .success(.init(name: "new name",
412419
description: "new description",
@@ -431,6 +438,9 @@ final class AccountStoreTests: XCTestCase {
431438
XCTAssertEqual(viewStorage.countObjects(ofType: Storage.Site.self, matching: jcpSitePredicate), 1)
432439
let jcpSite = try XCTUnwrap(viewStorage.firstObject(ofType: Storage.Site.self, matching: jcpSitePredicate))
433440
XCTAssertEqual(jcpSite.siteID, siteID)
441+
XCTAssertEqual(jcpSite.name, "old name")
442+
XCTAssertEqual(jcpSite.tagline, "old description")
443+
XCTAssertEqual(jcpSite.url, "oldurl")
434444
XCTAssertTrue(jcpSite.isWooCommerceActive?.boolValue == false)
435445
XCTAssertFalse(jcpSite.isJetpackThePluginInstalled)
436446
XCTAssertTrue(jcpSite.isJetpackConnected)

0 commit comments

Comments
 (0)