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

[Auto-upload Published] Auto-upload published posts with failed media #12498

Closed
shiki opened this issue Sep 9, 2019 · 2 comments
Closed

[Auto-upload Published] Auto-upload published posts with failed media #12498

shiki opened this issue Sep 9, 2019 · 2 comments

Comments

@shiki
Copy link
Member

shiki commented Sep 9, 2019

📣 Part of #12240. Changes should target issue/12240-master-branch.

In #12466, we found that locally published posts are not set to be automatically uploaded. We added auto-uploading in #12252 but we seemed to have missed this case.

Steps to reproduce

  1. Use issue/12240-master-branch
  2. Go offline.
  3. Create a post and add an image.
  4. Tap on Publish in the top right and publish the post.

Notice that the Post List says “Upload failed” instead of “Post will be published...”.

Investigation

Described from the comment #12466 (comment), the shouldAttemptAutoUpload returns false. This is why the action is .autoSave instead of .upload. The shouldAttemptAutoUpload is initially set to true here:

self.post.shouldAttemptAutoUpload = true

However, something in our code changed the status to .failed which resulted in the hash changing, and ultimately the shouldAttemptAutoUpload return value.

- (NSString *)calculateConfirmedChangesContentHash {
// The list of the properties we're taking into account here broadly mirrors: https://github.com/wordpress-mobile/WordPress-FluxC-Android/blob/f9e7fbae2479ad71bd2d1c7039f6f2bbbcc9444d/fluxc/src/main/java/org/wordpress/android/fluxc/model/PostModel.java#L443-L473
// Note that some of the properties aren't found on `AbstractPost`, but rather on `Post` and/or `Page` —
// that's the purpose of the `-additionalContentHashes` extension point.
NSArray<NSData *> *hashedContents = @[
[self hashForNSInteger:self.blog.dotComID.integerValue],
[self hashForNSInteger:self.postID.integerValue],
[self hashForString:self.postTitle],
[self hashForString:self.content],
[self hashForDouble:self.dateCreated.timeIntervalSinceReferenceDate],
[self hashForString:self.permaLink],
[self hashForString:self.mt_excerpt],
[self hashForString:self.status],
[self hashForString:self.password],
[self hashForString:self.author],
[self hashForNSInteger:self.authorID.integerValue],
[self hashForString:self.featuredImage.identifier],
[self hashForString:self.wp_slug]];

This is a case we probably did not find during #12252. Though it's worth investigating if this worked in #12252 and we somehow changed the location of when we set shouldAttemptUpload to true.

@yaelirub
Copy link
Contributor

yaelirub commented Sep 15, 2019

@shiki , @leandroalonso after pulling the latest fixes this doesn't seem to be an issue anymore.
Can you confirm?
20190915_124827

@leandroalonso
Copy link
Contributor

@yaelirub it's still happening here:

Screen Shot 2019-09-20 at 14 38 10

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants