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

Reader Refresh: rule-pick-canonical-media #9288

Conversation

samouri
Copy link
Contributor

@samouri samouri commented Nov 11, 2016

As was suggested in here, I've created rule-pick-canonical-media to help with post-classification and styling of cards.

This also obviates the need for FeaturedAsset as its own Component.

Fixes #9239.

This change is dependent on #9149 landing

To test:

@samouri samouri added [Feature] Reader The reader site on Calypso. [Status] In Progress labels Nov 11, 2016
@samouri samouri added this to the Reader Stream Refresh: Cards milestone Nov 11, 2016
@matticbot
Copy link
Contributor

…d classification

- added the rule pick-canonical-media as a replacement for our featured-asset component
- modified how we classify cards so that a card featuring a video will not be styled as if it were PHOTO_ONLY
@samouri samouri force-pushed the add/reader/refresh-rule-pick-canonical-media branch from 22ff283 to 2a6776b Compare November 11, 2016 01:46
@samouri samouri added the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label Nov 11, 2016
@samouri samouri self-assigned this Nov 11, 2016
@samouri samouri changed the title Add/reader/refresh rule pick canonical media Reader Refresh: rule-pick-canonical-media Nov 11, 2016
}

const featuredMedia = find( post.content_media, isCandidateForFeature );
const canonicalMedia = find( post.content_media, isCandidateForFeature );
post.canonical_media = { ...canonicalMedia };
Copy link
Contributor

Choose a reason for hiding this comment

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

why the copy here?

if ( ! canonicalImage || post.content_embeds.length === 1 ) {
displayType ^= DISPLAY_TYPES.FEATURED_VIDEO;
}
if ( post.canonical_media && post.canonical_media.mediaType === 'video' ) {
Copy link
Contributor

Choose a reason for hiding this comment

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

niiiiiiice

hasShortContent( post ) ) {
displayType ^= DISPLAY_TYPES.PHOTO_ONLY;
}

if ( canonicalImage ) {
// TODO do we still need aspect logic here and any of these?
Copy link
Contributor

Choose a reason for hiding this comment

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

we may for the old streams.

@blowery blowery merged commit 9231c86 into add/reader/refresh-prefer-first-media Nov 11, 2016
@blowery blowery deleted the add/reader/refresh-rule-pick-canonical-media branch November 11, 2016 20:20
@blowery blowery removed the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label Nov 11, 2016
blowery pushed a commit that referenced this pull request Nov 11, 2016
…ge (#9149)

* Reader Refresh: Prefer first media in assence of canonical image

* addressed some of blowery's offline comments

* fixed the height:0 issue BUT now its a UX issue ...

* fixed order of Object.assign for height/width

* changes needed after eagerly grab height/width landed

* added a check for featured images to be large enough based on post_thumbnail

* Reader Refresh: rule-pick-canonical-media (#9288)

* Reader Refresh: add canonical_media detection as a rule to enable card classification

- added the rule pick-canonical-media as a replacement for our featured-asset component
- modified how we classify cards so that a card featuring a video will not be styled as if it were PHOTO_ONLY

* don't copy the canonical media and only set it to a found value
bisko pushed a commit that referenced this pull request Nov 16, 2016
…ge (#9149)

* Reader Refresh: Prefer first media in assence of canonical image

* addressed some of blowery's offline comments

* fixed the height:0 issue BUT now its a UX issue ...

* fixed order of Object.assign for height/width

* changes needed after eagerly grab height/width landed

* added a check for featured images to be large enough based on post_thumbnail

* Reader Refresh: rule-pick-canonical-media (#9288)

* Reader Refresh: add canonical_media detection as a rule to enable card classification

- added the rule pick-canonical-media as a replacement for our featured-asset component
- modified how we classify cards so that a card featuring a video will not be styled as if it were PHOTO_ONLY

* don't copy the canonical media and only set it to a found value
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Reader The reader site on Calypso.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants