Prior to this commit, our fallback HREF was using only the URL's
domain (e.g. `guides.rubyonrails.org/routing.html`) instead of the
provided URL (e.g. `https://guides.rubyonrails.org/routing.html`). This
resulted in the link resolving to
`<url-of-article>/guides.rubyonrails.org/routing.html`)
With this commit, we're using the given URL for the HREF.
An interesting side note, the Ruby on Rails guides includes an
`og:title` but not an `og:url` so we hit the fallback condition. Could
we use the given URL if `og:url` does not exist?
Fixesforem/forem#17679
* Allowing VariantQuery for Feed Generation
Apologies for the breadth of this pull request, I had considered many
small commits, but felt that would've been more effort for the value
provided.
This commit includes the following:
- Documentation updates to the feed variant (though not the final pass)
- Renaming and adding RelevancyLevers that help differentiate
- Adding RelevancyLever#range to provide documentation
- Reducing redundent controller logic by making a
`Articles::Feeds.feed_for` method.
- Adding some configuration validation for RelevancyLevers
- Adding constants for better clarification
- Testing unhappy paths for feed configuration
- Adjusting the module namespace of some objects
- Exposing top-level configurations for variants (along with their
defaults)
- Creating the VariantyQuery that at present inherits from the
`Articles::Feeds::WeightedQueryStrategy`
As implemented, we can deploy this code to production without using the
new VariantQuery. Once we toggle on the
`:feed_uses_variant_query_feature` FeatureFlag, it will switch to using
the VariantQuery. The VariantQuery's two variants and the
internal configuration of `Articles::Feeds::WeightedQueryStrategy`
produce the same query.
The goal of this factor is to allow for a quick on and off toggle of the
feed query; to ensure that what we introduce remains performant.
- Closesforem/forem#17272
- Closesforem/forem#17276
- Closesforem/forem#17216
In addition, I will be recording a code-walkthrough and linking that
recording to the pull request.
* Apply suggestions from code review
Co-authored-by: Mac Siri <krairit.siri@gmail.com>
Co-authored-by: Mac Siri <krairit.siri@gmail.com>
* Remove approvals fixtures
* Remove approvals initializer
* Remove approvals gem
* Remove approvals step from travis.yml
* Remove approvals from dockerignore and gitignore
* Remove references to approvals gem in docs
* Un-approvals spec/liquid_tags/codepen_tag_spec.rb
* Un-approvals spec/liquid_tags/dotnet_fiddle_tag_spec.rb
* Temporarily skip other approvals tests
We will still need to delete files in /spec/fixtures/approvals after this.
* Revert changes to dotnet_fiddle_tag_spec and codepen_tag_spec, skip those tests instead
* Temporarily skip more approvals based tests
* Attempt at moving html doc inline
* Comment out one more approvals spec
* Update dotnet fiddle and codepen liquid tag specs to not use Approvals
* Update liquid tag specs + system specs to not use Approvals
* Un-approval feed import, github issue, and tweet tag specs
* Re-add .approvals to gitignore and dockerignore
* Use Rspec compound expectations
* Prepare to drop profile columns from user
* Update code and factory
* Also remove unused constant
* Move validation from user to profile
* Remove Profiles::ExtractData service object
* Add more comments
* Simplify sameAs attribute generation
* Obey me machine, I am your master
* Fix condition order in guard clause
* Temporarily disable callback
* Fix specs
* Reduce usage of Profile#refresh_attributes!
* Remove leftover comment
* Handle social media links differently
* More spec fixes
* Fix specs for admin profile fields controller
* Fix specs after merge
* Fix remaining specs
* Update user show request spec
* Add comment for follow_hiring_tag
* Only save profile when user is valid
* Fix seeds.rb for profile fields
* Switch from before_save to after_save
* Undo unrelated formattin change
* Update spec/fixtures/files/profile_fields.csv
Co-authored-by: Molly Struve <mollylbs@gmail.com>
* Remove data update script and spec
* Fix spec
* Fix typo in comment
* Fix typo in comment
* Move article resave logic to service object
* Move profile field creation to before(:suite)
* Refactor error handling in Profiles::Update
* Fix Profiles::Update specs and refactor
* Temporarily disable spec
* Add ProfileValidator
* Clean up
* Move DB ready check into app/lib
* Refresh attributes after importing from CSV
* Fix specs
* Remove unused file
* A girl has no name. A profile neither.
* Fix specs
* Add responds_to? check
* Spec fix
* Add name to user fields in profile settings page
Co-authored-by: Molly Struve <mollylbs@gmail.com>
* Add the parallel gem
* Add prototype version of Feeds::Import with parallel URL fetching and parsing
* Tune Feeds::Import and add rake task for local tests
* Add rough measurer tool
* Add specs
* Apply suggestions by @citizen428
* Replace silence with silent
* No need for eager loading
* Add temporary Articles::DevFeedsImportWorker
* Remove temporary rake task
* Add basic error handling, copied from RssReader
* Fix error handling
* Remove temporary measuring rake task
* Remove logging added for development purposes
* Add info and error logging on error level
* Fix schema.rb
* Add service objects for base and link fields
* Add link fields to seeds
* Make placeholder a keyword argument
* Add work fields
* Add explanation column to profile fields
* Add coding fields
* Switch from inheritance to mixin
* Add email checkbox to base fields
* Add branding fields
* Add spec for ProfileFields::FieldDefinition
* Move migration back into correct location
* Rename column from explanation to description
* Rename attribute in mixin
* chore: rename from explanation to description
* Add ProfileFields::ImportFromCsv
* Simplify ProfileFields::ImportFromCsv
* Add comment about disabled cop to spec
* Add TODO comment to Rake task
* Document mixin
* Add groups to profile fields
Co-authored-by: Ridhwana <ridhwana.khan16@gmail.com>
* Add TwitterClient::Client
* Use TwitterClient::Client for Tweet
* Test retweets
* Test assignment to user
* Fix TweetTag spec
* Remove TwitterBot
* Fix some specs
* Fix RSS Reader specs
* Fix Runkit tags not being activated when comment is added
* Runkit tag activation was ran once, on page load. I've changed it to
run on on comment preview and submit.
* It was necessary to add a check to skip already activated Runkit
tags. The code didn't take into account that a tag could be already
processed, and would just crash.
* Fix Runkit tags and add tests
* Add test for previewing article with Runkit tag
* "Fix CodeClimate not finding waitForRunkitAndActivateTags()
* Refactor a test for readability
* Make Rubocop happy
* Improve test for previewing article with Runkit tag
* Use one method for determining active Runkit tags
* Defer loading of JS from embed.runkit.com
* Add utility function dynamicallyLoadScript(url)
* Switch to dynamic loading of Runkit
* parsed content code block is also hidden now to avoid displaying <code /> block before runkit iframe loads.
* Fix Runkit test
* Remove Runkit script caching in v2 form
* Use <%== instead of .html_safe in v2 form
* Update app/assets/javascripts/utilities/dynamicallyLoadScript.js
Co-authored-by: Nick Taylor <nick@iamdeveloper.com>
Co-authored-by: Nick Taylor <nick@iamdeveloper.com>
Currently, we don't allow users to remove the `main_image` of an article once it has been set. It can be changed, but never removed.
This change allows the `main_image` to be removed by checking for the `cover_image` key in the frontmatter that is sent along in the article's markdown. This means that a user should be able to remove the image associated with an article by removing the value of `cover_image:` from their frontmatter.
* Create podcast as a user [WIP]
* Sample css for podcast form
* Nicer podcasts suggesting form
* Validate podcast feed_url
* Validate podcast main_color_hex
* Fix podcasts specs
* Fix form appearance
* Placeholder for podcast main_color_hex
* Provide a link to suggest a podcast
* Add a checkbox and a role for when a podcast is added by an owner
* Prettier checkbox in the podcasts form
* Added creator to podcasts
* Set the podcast creator
* Fix the /pod spec
* Added creator information to the internal podcast page
* Added cta class to the podcasts submit button
* Global notice when a podcast was suggested
Co-authored-by: Ben Halpern <bendhalpern@gmail.com>
* Add specs for ArticleImageUploader
* Add specs for BadgeUploader
* Add specs for CoverImageUploader
* Add specs for ProfileImageUploader
* Refactor uploaders to inherit from BaseUploader
* Strip EXIF and GPS data from uploaded images
* Add ImageMagick to the docs
* Protect strip_exif
* Add system test to create article from the editor
* Move article creation from API to app controller
* Fix system test to edit posts
* Move article update from API to app controller
* Rewrite create article API using API key
* Add main_image and canonical_url to allowed creation params
* Rewrite update article API using API key
* Fix tests and have Comments API inherit from API
* Switch from deprecated honeycomb-rails to honeycomb-beeline
* Improve error handling, tests and add refactoring
* Fix multiple fetching test and add one more
The test wasn't actually testing the correct behavior, because the class
by default force fetches. It worked because it wasn't reloading the user
from the database.
* Test that Honeycomb's client is doing its thing
* Use some defensive programming to avoid any possible problem during shutdown
* Fix typo
* Use the new API to add fields to the current measured event
* Use default instrumentation and add user info to event
* Replace user.email with user.username, less personal data around
* Use mocking instead of calling Honeycomb.init
* Freeze time before traveling
* Remove a flaky test dependent on rand