Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Moving a post created in-app to a blog on the web doesn't update the app correctly #247

Closed
AngeloStavrow opened this issue Apr 23, 2023 · 1 comment · Fixed by #250
Closed
Labels
bug Something isn't working ios Anything specific to the iPhone/iPad app reproduced The bug has been confirmed

Comments

@AngeloStavrow
Copy link
Collaborator

Steps to reproduce

  1. On the iOS app, create and publish a new anonymous post
  2. On the web, move the anonymous post from step 1 to a blog
  3. Tap the refresh button on the iOS app

Expected

The post is updated in the iOS app to show under the blog it was moved to in step 2 above.

Actual

The post remains in the anonymous draft list.

@AngeloStavrow AngeloStavrow added bug Something isn't working ios Anything specific to the iPhone/iPad app reproduced The bug has been confirmed labels Apr 23, 2023
@AngeloStavrow
Copy link
Collaborator Author

AngeloStavrow commented May 2, 2023

When the completion handler for our fetchUserPosts method runs, there's a block that checks for deleted or remotely-modified posts:

if let managedPost = locallyCachedPosts.first(where: { $0.postId == fetchedPost.postId }) {
DispatchQueue.main.async {
managedPost.wasDeletedFromServer = false
if let fetchedPostUpdatedDate = fetchedPost.updatedDate,
let localPostUpdatedDate = managedPost.updatedDate {
managedPost.hasNewerRemoteCopy = fetchedPostUpdatedDate > localPostUpdatedDate
} else {
self.currentError = AppError.genericError(
"Error updating post: could not determine which copy of post is newer."
)
}
postsToDelete.removeAll(where: { $0.postId == fetchedPost.postId })
}
} else {

This should also compare the collectionAlias field of the WFAPost object that was fetched from the server against the locally managed object and, if they differ, move it appropriately.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working ios Anything specific to the iPhone/iPad app reproduced The bug has been confirmed
Development

Successfully merging a pull request may close this issue.

1 participant