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

AMP: Fix too high refresh interval #663

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

philipjohn
Copy link
Contributor

The refresh interval can be set by the site owner to any value. On AMP liveblogs this is used for the data-poll-interval in the amp-live-list but that value has to be greater than 15. https://amp.dev/documentation/examples/components/amp-live-list/

This change ensures that AMP Liveblogs have a minimum interval of 15.

When building, NPM reports the following error:

> error  Using target="_blank" without rel="noopener noreferrer" is a security risk: see https://mathiasbynens.github.io/rel-noopener  react/jsx-no-target-blank

This change fixes that by adding the required rel attribute to the link.
The refresh interval can be set by the site owner to any value. On AMP liveblogs this is used for the `data-poll-interval` in the `amp-live-list` but that value has to be greater than 15. https://amp.dev/documentation/examples/components/amp-live-list/

This change ensures that AMP Liveblogs enforce a minimum value of 15 for the interval.
@@ -332,7 +332,7 @@ public static function build_entries_feed( $entries, $request, $post_id ) {
'last' => get_query_var( 'liveblog_last', false ),
'settings' => array(
'entries_per_page' => WPCOM_Liveblog_Lazyloader::get_number_of_entries(),
'refresh_interval' => WPCOM_Liveblog::get_refresh_interval(),
'refresh_interval' => min( 15, WPCOM_Liveblog::get_refresh_interval() ),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe put this in a constant.

@GaryJones GaryJones added this to the 1.next milestone Jun 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants