Skip to content
This repository was archived by the owner on Feb 4, 2025. It is now read-only.

Commit 8808e6d

Browse files
authored
Merge pull request #1064 from wordpress-mobile/fix/avoid-update-posts-if-locally-changed-take2
Only overwrite Posts that don't have local changes
2 parents 9caaf44 + 3015bc6 commit 8808e6d

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

fluxc/src/main/java/org/wordpress/android/fluxc/store/PostStore.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -605,8 +605,9 @@ private void handleFetchedPostList(FetchPostListResponsePayload payload) {
605605
Map<Long, PostModel> posts = getPostsByRemotePostIds(postIds, site);
606606
for (PostListItem item : payload.postListItems) {
607607
PostModel post = posts.get(item.remotePostId);
608-
// Dispatch a fetch action for the posts that are changed
609-
if (post != null && !post.getLastModified().equals(item.lastModified)) {
608+
// Dispatch a fetch action for the posts that are changed, but not for posts with local changes
609+
// as we'd otherwise overwrite and lose these local changes forever
610+
if (post != null && !post.getLastModified().equals(item.lastModified) && !post.isLocallyChanged()) {
610611
mDispatcher.dispatch(PostActionBuilder.newFetchPostAction(new RemotePostPayload(post, site)));
611612
}
612613
}

0 commit comments

Comments
 (0)