From 22f54e7857a41b391b059202e04fe0364adf7d75 Mon Sep 17 00:00:00 2001
From: Antonis Lilis <antonis.lilis@automattic.com>
Date: Wed, 11 Nov 2020 13:24:31 +0200
Subject: [PATCH] Prevents saving post locally in preview mode

---
 .../java/org/wordpress/android/ui/posts/EditPostActivity.java | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/WordPress/src/main/java/org/wordpress/android/ui/posts/EditPostActivity.java b/WordPress/src/main/java/org/wordpress/android/ui/posts/EditPostActivity.java
index 67acd59eb1c0..3a7ade10de3e 100644
--- a/WordPress/src/main/java/org/wordpress/android/ui/posts/EditPostActivity.java
+++ b/WordPress/src/main/java/org/wordpress/android/ui/posts/EditPostActivity.java
@@ -860,7 +860,9 @@ private void startObserving() {
             return null;
         }));
         mEditPostRepository.getPostChanged().observe(this, postEvent -> postEvent.applyIfNotHandled(post -> {
-            mViewModel.savePostToDb(mEditPostRepository, mSite);
+            if (!mIsPreview) {
+                mViewModel.savePostToDb(mEditPostRepository, mSite);
+            }
             return null;
         }));
     }