diff --git a/WordPress/src/main/java/org/wordpress/android/ui/posts/PostListMainViewModel.kt b/WordPress/src/main/java/org/wordpress/android/ui/posts/PostListMainViewModel.kt index e5a5caf976da..2bc02b8388b7 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/posts/PostListMainViewModel.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/posts/PostListMainViewModel.kt @@ -401,9 +401,18 @@ class PostListMainViewModel @Inject constructor( } fun handleEditPostResult(data: Intent?) { + switchToDraftTabIfNeeded(data) postActionHandler.handleEditPostResult(data) } + private fun switchToDraftTabIfNeeded(data: Intent?) { + if (data != null && data.getBooleanExtra(EditPostActivity.EXTRA_IS_NEW_POST, false) && + data.getBooleanExtra(EditPostActivity.EXTRA_HAS_CHANGES, false) + ) { + _selectTab.value = POST_LIST_PAGES.indexOf(DRAFTS) + } + } + private fun editRestoredAutoSavePost(localPostId: Int) { val post = postStore.getPostByLocalPostId(localPostId) if (post != null) {