-
Notifications
You must be signed in to change notification settings - Fork 219
Conversation
e387f6d
to
78c1f54
Compare
78c1f54
to
e6f6840
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What an amazing cleanup!
Just mind the small observations I've made thru this diff.
@@ -342,20 +334,47 @@ function inject_url_claiming_meta_tag() { | |||
$publishing_settings = Instant_Articles_Option_Publishing::get_option_decoded(); | |||
$fb_page_settings = Instant_Articles_Option_FB_Page::get_option_decoded(); | |||
|
|||
if ( isset( $fb_page_settings['page_id'] ) ) { | |||
if ( isset( $fb_page_settings[ 'page_id' ] ) ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice catch 💅
?> | ||
<meta property="fb:pages" content="<?php echo esc_attr( $fb_page_settings['page_id'] ); ?>" /> | ||
<meta property="fb:pages" content="<?php echo esc_attr( $fb_page_settings[ 'page_id' ] ); ?>" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice catch 💅
facebook-instant-articles.php
Outdated
// Transform the post to an Instant Article. | ||
$adapter = new Instant_Articles_Post( $post ); | ||
$url = $adapter->get_canonical_url(); | ||
$url = add_query_arg( 'op', '1', $url ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we removed the op: ("Open publisher") thing. Shouldn't we change this op=1 thing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will replace "op" by "ia_markup"
facebook-instant-articles.php
Outdated
<meta property="ia:markup_url" content="<?php echo esc_attr( $url ); ?>" /> | ||
<?php | ||
} | ||
add_action( 'wp_head', 'inject_op_markup_meta_tag' ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same thing about "op" usage. Maybe we should drop this OP from everywhere.
facebook-instant-articles.php
Outdated
function op_markup_version( ) { | ||
$post = get_post(); | ||
|
||
if (isset($_GET['op']) && $_GET['op']) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2 things:
- Formating nit, should be
if ( isset( $_GET[ 'op' ] ) && $_GET[ 'op' ] ) {
- Same thing about "op" usage. Maybe we should drop this OP from everywhere.
facebook-instant-articles.php
Outdated
// Transform the post to an Instant Article. | ||
$adapter = new Instant_Articles_Post( $post ); | ||
$article = $adapter->to_instant_article(); | ||
echo $article->render(null, true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💅
echo $article->render( null, true );
facebook-instant-articles.php
Outdated
die(); | ||
} | ||
} | ||
add_action( 'wp', 'op_markup_version' ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same thing about "op" usage. Maybe we should drop this OP from everywhere.
@@ -1,135 +0,0 @@ | |||
function instant_articles_wizard_load ( data ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good code cleanup! 👍
@@ -73,6 +73,7 @@ public function testTransformerLikeWPContent() | |||
|
|||
$this->assertEquals($expected, $result); | |||
// there must be 3 warnings related to <img> inside <li> that is not supported by IA | |||
// And 1 warning related to the getter |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you sure this comment should be added?
If there are 3 related to img + 1, the test assertion should be 4.
I guess this came from some dirty merge.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense =) I'll remove it.
dec8fdd
to
cd9b2ce
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔥 Burning code!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Great work, @diegoquinteiro!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just rebase before landing
f8dc6e4
to
738ff77
Compare
This ingestion flow takes in consideration how is the current status of the setup. If setup is already complete on API, it means a migration, set the configuration as API and the flow goes that way otherwise set the configuration as Open Graph and flow goes this way
- [x] Edit doesn't erase content - [x] Fixed issue on Advanced Settings - [x] Removed extra code
* Removed the wizard * Added a page_id field on the settings * Removed unused pages, javascripts and templates
57a9635
to
9013127
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We (I and @vkama) agreed to merge it to v4.0 then fix the issues on a new PR.
meta-box/meta-box-template.php
Outdated
</b> | ||
</p> | ||
<hr> | ||
<?php elseif ( ! $should_submit_post ) : ?> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rename this variable
</b> | ||
</p> | ||
<hr> | ||
<?php elseif ( ! $article->getHeader() || ! $article->getHeader()->getTitle() ) : ?> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move to a warning on the SDK
meta-box/meta-box-template.php
Outdated
<p> | ||
<b> | ||
<span class="dashicons dashicons-no-alt"></span> | ||
This post will not be submitted to Instant Articles because it is missings content. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo (missings)
</b> | ||
</p> | ||
<hr> | ||
<?php elseif ( count( $article->getChildren() ) === 0 ) : ?> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move to a warning on the SDK
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice work! Excited to see such a huge clean up and improved user experience through not having to deal with tokens and other stuff!
Great job!
@@ -102,7 +102,7 @@ function instant_articles_activate() { | |||
add_action( 'network_admin_notices', 'instant_articles_setup_admin_notice' ); // also show message on multisite | |||
function instant_articles_setup_admin_notice() { | |||
global $pagenow; | |||
if ( $pagenow === 'plugins.php' && Instant_Articles_Wizard_State::get_current_state() !== Instant_Articles_Wizard_State::STATE_REVIEW_SUBMISSION ) { | |||
if ( $pagenow === 'plugins.php' && ! Instant_Articles_Option_FB_Page::get_option_decoded()[ "page_id" ] ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this possibly throw a warning if no 'page_id' is set? Also, maybe using single quotes.
@@ -96,7 +96,7 @@ public static function render_meta_box() { | |||
$published = ( 'publish' === $post->post_status ); | |||
$dev_mode = false; | |||
$force_submit = get_post_meta( $post_id, IA_PLUGIN_FORCE_SUBMIT_KEY, true ); | |||
$should_submit_post = apply_filters( 'instant_articles_should_submit_post', true, $adapter ); | |||
$instant_articles_should_submit_post_filter = apply_filters( 'instant_articles_should_submit_post', true, $adapter ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am seeing this a lot in the code (lines 92 to 99), maybe we should think of a better solution so this boilerplate gets reused? Good for now, but lets aim for this refactor.
60 | ||
); | ||
foreach ( $old_slugs as $slug ) { | ||
$clone_post = clone $post; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this clonning really be inside the foreach? since only the post name is getting changed, maybe you can clone it once, outside, if at all.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good call, I'll create a PR for improving the performance here
$old_slugs = get_post_meta( $post_id, '_wp_old_slug' ); | ||
if ( $adapter->should_submit_post() ) { | ||
try { | ||
$client = Facebook\HttpClients\HttpClientsFactory::createHttpClient( null ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this now the only time we use the graph-sdk? if so, maybe we should consider either using builtin functions for a simple post or actually copying the class and dropping it as a dep?
facebook-instant-articles.php
Outdated
@@ -404,4 +404,44 @@ function ia_markup_version( ) { | |||
add_action( 'wp', 'ia_markup_version' ); | |||
|
|||
Instant_Articles_Wizard::init(); | |||
|
|||
function rescrape_article( $post_id, $post ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is the $post_id required? isnt that the same as $post->ID?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is not required, but these are the parameters passed to the hook by WordPress.
This PR is a clean/rebased version of #548