Skip to content

Commit

Permalink
Add autosave modified field back
Browse files Browse the repository at this point in the history
  • Loading branch information
maxme committed Aug 22, 2019
1 parent 5fbbf51 commit 57cc768
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ public void onResponse(PostsResponse response) {
postListAutoSave.content = postResponse.getPostAutoSave().getContent();
postListAutoSave.excerpt = postResponse.getPostAutoSave().getExcerpt();
postListAutoSave.previewUrl = postResponse.getPostAutoSave().getPreviewUrl();
postListAutoSave.modified = postResponse.getPostAutoSave().getModified();
}
postListItems
.add(new PostListItem(postResponse.getRemotePostId(), postResponse.getModified(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ public FetchPostListPayload(PostListDescriptor listDescriptor, long offset) {
public static class PostListItem {
public static class PostListAutoSave {
public long revisionId = 0;
public String modified;
public String previewUrl;
public String title;
public String content;
Expand Down Expand Up @@ -730,7 +731,8 @@ private void handleFetchedPostList(FetchPostListResponsePayload payload) {
* was updated. However, if we know the last modified date is equal to the date we have in local
* autosave object we are sure that our invocation of /autosave updated the post directly.
*/
if (isPostChanged && item.lastModified.equals(post.getAutoSaveModified())) {
if (isPostChanged && item.lastModified.equals(post.getAutoSaveModified())
&& item.autoSave.modified == null) {
isPostChanged = false;
}

Expand All @@ -749,6 +751,7 @@ private void handleFetchedPostList(FetchPostListResponsePayload payload) {
post.setAutoSaveContent(item.autoSave.content);
post.setAutoSaveExcerpt(item.autoSave.excerpt);
post.setAutoSavePreviewUrl(item.autoSave.previewUrl);
post.setAutoSaveModified(item.autoSave.modified);
mDispatcher.dispatch(PostActionBuilder.newUpdatePostAction(post));
}
}
Expand Down

0 comments on commit 57cc768

Please sign in to comment.