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

Store and use submission ID when available to fetch the status #353

Merged
merged 1 commit into from Jul 12, 2016

Conversation

Projects
None yet
3 participants
@diegoquinteiro
Copy link
Collaborator

commented Jul 11, 2016

This PR:

  • Stores the submission ID of the posted article on post metadata.
  • Uses the stored submission ID when available to fetch the article status instead of always getting it from the URL.

This fixes an issue where the meta-box does not show that the article was submitted unless you refresh the edit post screen, which feels broken.

@diegoquinteiro diegoquinteiro added this to the 3.0 milestone Jul 11, 2016

@diegoquinteiro

This comment has been minimized.

Copy link
Collaborator Author

commented Jul 11, 2016

@philipjohn if you can, it would be awesome to include this one on 3.0 tomorrow (but let's not delay the release because of it if you can't).

} catch ( Exception $e ) {
// Try without taking live for pages not yet reviewed.
$client->importArticle( $article, false );
$submission_id = $client->importArticle( $article, false );
update_post_meta( $post_id, self::SUBMISSION_ID_KEY, $submission_id );

This comment has been minimized.

Copy link
@everton-rosario

everton-rosario Jul 11, 2016

Collaborator

Does this try/catch works well?
Is it needed to try twice?
I know it was here before, but looks weird.
Its ok to just file an issue so we can double check it later.

This comment has been minimized.

Copy link
@diegoquinteiro

diegoquinteiro Jul 11, 2016

Author Collaborator

When we try to publish, we send it with the flag to take it live. If the page is still pending review, this particular call will fail and an Exception is thrown. We then try to send it without the flag.

This way, while the page is under review, we always send the request twice. But when the page is approved, we always send a single request.

We could, instead, check the review status before and include the flag or not based on the status. But that would mean 2 requests are made (checking the status then sending) in both scenarios. It is a clearer solution, but the current solution performs better on the average case.

We can discuss it later, it is not on the scope of this PR.

@everton-rosario

This comment has been minimized.

Copy link
Collaborator

commented Jul 11, 2016

Take a look on my inline comment.

LGTM

@everton-rosario

This comment has been minimized.

Copy link
Collaborator

commented Jul 11, 2016

:ship

@philipjohn philipjohn merged commit 6a439cb into master Jul 12, 2016

@philipjohn philipjohn deleted the store_submission_id branch Jul 12, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.