Skip to content

Remove the sync_publishing feature flag and dead code behind it #22777

@jkmassel

Description

@jkmassel

Summary

The sync_publishing feature flag (backing PostConflictResolutionFeatureConfig) is hardcoded to false in build.gradle and has never been enabled. All code gated behind it is dead code. We should remove the flag and clean up all associated code paths.

What the flag gates

The flag controls a post conflict resolution system that detects when a post has been edited on another device and presents UI to resolve the conflict. When disabled (current state), all conflict checks are skipped (shouldSkipConflictResolutionCheck = true) and legacy dialogs are shown instead of the newer overlay UI.

Key behaviors gated behind the flag

  1. Post/Page conflict resolution overlay — A Compose-based bottom sheet (PostResolutionOverlayFragment) that lets users choose between a local or remote version of a conflicted post/page
  2. Post freshness checking in the editor — On opening a post in EditPostActivity / GutenbergKitActivity, checks if a newer remote version exists and shows an "Updating Post" UI
  3. if_not_modified_since header on push — Sends a last-modified timestamp when pushing posts so the backend can return a 409 on conflict (via PostConflictResolutionFeatureUtils.getRemotePostPayloadForPush)
  4. Conflict detection on edit — In PagesViewModel.checkAndEdit(), checks for unhandled conflicts before opening the editor

Files to modify or remove

Files to delete entirely

  • WordPress/src/main/java/org/wordpress/android/util/config/PostConflictResolutionFeatureConfig.kt
  • WordPress/src/main/java/org/wordpress/android/ui/posts/PostConflictResolutionFeatureUtils.kt
  • WordPress/src/main/java/org/wordpress/android/ui/posts/PostResolutionOverlay.kt
  • WordPress/src/main/java/org/wordpress/android/ui/posts/PostResolutionOverlayAnalyticsTracker.kt
  • WordPress/src/main/java/org/wordpress/android/ui/posts/PostResolutionOverlayFragment.kt
  • WordPress/src/main/java/org/wordpress/android/ui/posts/PostResolutionOverlayListener.kt
  • WordPress/src/main/java/org/wordpress/android/ui/posts/PostResolutionOverlayUiState.kt
  • WordPress/src/main/java/org/wordpress/android/ui/posts/PostResolutionOverlayViewModel.kt
  • WordPress/src/main/java/org/wordpress/android/ui/posts/PostConflictResolver.kt
  • WordPress/src/main/java/org/wordpress/android/viewmodel/pages/PageConflictResolver.kt
  • WordPress/src/test/java/org/wordpress/android/ui/posts/PostConflictResolutionFeatureUtilsTest.kt
  • WordPress/src/test/java/org/wordpress/android/ui/posts/PostResolutionOverlayAnalyticsTrackerTest.kt
  • WordPress/src/test/java/org/wordpress/android/ui/posts/PostResolutionOverlayViewModelTest.kt
  • WordPress/src/test/java/org/wordpress/android/ui/posts/PostConflictResolverTest.kt

Files to modify (remove flag references and simplify)

  • WordPress/build.gradle — Remove the SYNC_PUBLISHING buildConfigField
  • WordPress/src/main/java/org/wordpress/android/ui/posts/PostListDialogHelper.kt — Remove flag-gated branches; keep only the else (disabled) paths
  • WordPress/src/main/java/org/wordpress/android/viewmodel/pages/PageListDialogHelper.kt — Same as above
  • WordPress/src/main/java/org/wordpress/android/ui/posts/PostListMainViewModel.kt — Remove PostConflictResolutionFeatureUtils injection and _conflictResolutionAction
  • WordPress/src/main/java/org/wordpress/android/viewmodel/pages/PagesViewModel.kt — Remove PostConflictResolutionFeatureUtils injection and conflict check in checkAndEdit()
  • WordPress/src/main/java/org/wordpress/android/ui/posts/editor/StorePostViewModel.kt — Remove PostConflictResolutionFeatureConfig injection and checkIfUpdatedPostVersionExists()/handlePostRefreshedIfNeeded() gated logic
  • WordPress/src/main/java/org/wordpress/android/ui/posts/EditPostActivity.kt — Remove PostConflictResolutionFeatureConfig injection and freshness-check observers
  • WordPress/src/main/java/org/wordpress/android/ui/posts/GutenbergKitActivity.kt — Same as EditPostActivity
  • WordPress/src/main/java/org/wordpress/android/ui/uploads/PostUploadHandler.java — Remove PostConflictResolutionFeatureUtils; always set shouldSkipConflictResolutionCheck = true
  • WordPress/src/main/java/org/wordpress/android/ui/posts/PostActionHandler.kt — Remove PostConflictResolutionFeatureUtils injection; simplify payload construction
  • WordPress/src/test/java/org/wordpress/android/viewmodel/pages/PagesViewModelTest.kt — Remove mock/references
  • WordPress/src/test/java/org/wordpress/android/ui/posts/editor/StorePostViewModelTest.kt — Remove mock/references
  • WordPress/src/test/java/org/wordpress/android/ui/posts/PostListMainViewModelTest.kt — Remove mock/references
  • WordPress/src/test/java/org/wordpress/android/ui/posts/PostListMainViewModelCopyPostTest.kt — Remove mock/references

FluxC files to review

  • libs/fluxc/src/main/java/org/wordpress/android/fluxc/store/PostStore.java — Check if shouldSkipConflictResolutionCheck / lastModifiedForConflictResolution on RemotePostPayload can be simplified
  • libs/fluxc/src/main/java/org/wordpress/android/fluxc/network/rest/wpcom/post/PostRestClient.java — Same
  • libs/fluxc/src/main/java/org/wordpress/android/fluxc/network/xmlrpc/post/PostXMLRPCClient.java — Same

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions