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

Add twitch liquid tags #10577

Merged
merged 4 commits into from
Oct 5, 2020

Conversation

ChaelCodes
Copy link
Contributor

@ChaelCodes ChaelCodes commented Oct 4, 2020

What type of PR is this? (check all applicable)

  • Refactor
  • Feature
  • Bug Fix
  • Optimization
  • Documentation Update

Description

Related Tickets & Documents

resolves #10475
Twitch Documentation on Embeds
Dev.To docs on Liquid Tags

QA Instructions, Screenshots, Recordings

Please replace this line with instructions on how to test your changes, as well
as any relevant images for UI changes.

Added tests?

  • yes
  • no, because they aren't needed
  • no, because I need help

Added to documentation?

  • docs.forem.com
  • readme
  • no documentation needed

@pr-triage pr-triage bot added the PR: draft bot applied label for PR's that are a work in progress label Oct 4, 2020
@CLAassistant
Copy link

CLAassistant commented Oct 4, 2020

CLA assistant check
All committers have signed the CLA.

@ChaelCodes ChaelCodes marked this pull request as ready for review October 4, 2020 23:37
@ChaelCodes ChaelCodes requested a review from a team October 4, 2020 23:37
@pr-triage pr-triage bot added PR: unreviewed bot applied label for PR's with no review and removed PR: draft bot applied label for PR's that are a work in progress labels Oct 4, 2020
@rhymes rhymes changed the title 10475 add twitch liquid tags Add twitch liquid tags Oct 5, 2020
Copy link
Contributor

@rhymes rhymes left a comment

Choose a reason for hiding this comment

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

Tested, it works great!

I left a non blocking note about making the tests a little bit more self explanatory but great job @ChaelCodes!

I also left a question :P

Comment on lines +27 to +29
def parsed_url(url)
url.split(":")[0]
end
Copy link
Contributor

Choose a reason for hiding this comment

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

I was going to suggest using ApplicationConfig.app_domain_no_port but that's tied to the environment variable. Let's keep this here, I'll add a SiteConfig.app_domain_no_port in a separate PR not to derail this one :)


# prevent param injection
def parsed_slug(slug)
slug.strip.split("&")[0]
Copy link
Contributor

Choose a reason for hiding this comment

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

FYI non blocking for-the-future: you can use .first instead of [0]

@@ -14,6 +14,7 @@ def has_vid?(article)

article.processed_html.include?("youtube.com/embed/") ||
article.processed_html.include?("player.vimeo.com") ||
article.processed_html.include?("clips.twitch.tv/embed") ||
Copy link
Contributor

Choose a reason for hiding this comment

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

can I ask you the reason for this change? I'm not super familiar with that part of the code, so I'm wondering why we need Fluidvids for a liquid tag if it's in an iframe, is it for the potential resizing of the container?

Comment on lines +20 to +22
it "forbids inserting autoplay option" do
assert_parses slug, "#{slug}&autoplay=true"
end
Copy link
Contributor

Choose a reason for hiding this comment

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

this test is not very self explanatory. "assert it parses the slug if you pass the slug with autoplay true" but maybe we should test "make sure the slug doesn't contain autoplay=true"

end

it "forbids inserting mute option" do
assert_parses slug, "#{slug}&muted=true"
Copy link
Contributor

Choose a reason for hiding this comment

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

same as above

@pr-triage pr-triage bot added PR: partially-approved bot applied label for PR's where a single reviewer approves changes and removed PR: unreviewed bot applied label for PR's with no review labels Oct 5, 2020
@rhymes rhymes requested a review from a team October 5, 2020 08:52
@benhalpern benhalpern merged commit 348aa3d into forem:master Oct 5, 2020
@pr-triage pr-triage bot added PR: merged bot applied label for PR's that are merged and removed PR: partially-approved bot applied label for PR's where a single reviewer approves changes labels Oct 5, 2020
boardfish pushed a commit to boardfish/forem that referenced this pull request Oct 17, 2020
* Add a Liquid Tag specifically for Twitch clips.

These will embed Twitch Clips in articles and comments.

* Update documentation to incorporate Twitch clip liquid tags.

* Include Twitch Clips in video embed logic

* Making a small change to rebuild
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR: merged bot applied label for PR's that are merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add Twitch Clips Liquid Tag
6 participants