* Initial basic work
* Bulk of related work, including find/replace on the inputs
* Adjust some tests
* Adjust some specs
* Fix a few more tests
* Clean up tests
* Adjust tests
* Test fiddle
* Adjust crop back to be a param
* Update tests
* Set proper defaults
* Fix some styling
* Adjust enrichment logic and tests
* Adjust form JS
* Update test snapshot
* Clean up formatting
* Fix spec name
* Adjust some css and defaults
* Adjust translation for image provider options
* Switch from fill to fill-down
* Proper fallback image
* Fix tests
* Update app/services/images/optimizer.rb
Co-authored-by: Mac Siri <mac@forem.com>
---------
Co-authored-by: Mac Siri <mac@forem.com>
Prior to this commit, we were somewhat naively rendering Hash style data
attributes in our ERB templates. By rendering each hash attribute
separately, we were rendering characters that could break the
javascript (e.g. double hack or backslash `"` or `\`).
By moving to this view_object rendering, we leverage Rails's `to_json`
behavior to ensure properly escaped values. As part of this exercise, I
generalized the method to allow for other places to benefit from this
behavior.
This generalization also helps ensure that we have a more conformant
rendering (e.g. we should always have an :id, :className, and :name
value in our data-info hash).
_Note: I've updated the user's names for Cypress tests as they are more
likely to catch the particular issue than anything else. I assume that
I'm going to break some cypress tests and will need some help fixing
them._
Closes#15916, #14704
Supersedes #15983
How to test locally:
Assuming you have seeded database (e.g. `rails db:seed`), checkout the
"main" branch. Then in `rails console` find a user that's written articles:
```ruby
user = Article.last.user
user.update(name: "\\: #{user.name}")
user.articles.each(&:save)
```
Now, again on the "main" branch, start your application (e.g.,
`bin/startup`).
Then get a logged in and a logged out browser session going. Open your
web inspector and open console. Then go to the local instances homepage
(e.g., http://localhost:3000) and look for JS errors.
On the main branch, you should see an exception around
`JSON.parse(button.data.info)` (assuming that the `user`'s article is
rendered on the homepage).
Then go to the user's page (e.g. https://localhost:3000/:user-slug) and
look for JS parse errors.
On this PR's branch (e.g.,
`jeremyf/take-two-at-resolving-gh-15916`)
you shouldn't see those console errors.
More importantly, the Follow buttons should work.
* Rename SiteConfig
* More renaming
* Update spec
* Update mandatory settings mapping
* More renaming
* e2e test fixes
* You have a rename, and you have a rename
* Spec fix
* More changes
* Temporarily disable specs
* After-merge update
* Undo rename for migration
* undo rename of DUS
* Fix DUS
* Fix merge problem
* Remove redundant DUS
* Fix specs
* Remove unused code
* Change wrong class name
* More cleanup
* Re-add missing values to constant
* Fix constant
* Fix spec
* Remove obsolete fields
* Add accidentally removed field
* Update spec
* Move methods from Settings::General to ForemInstance
* Remove unneeded model
* Change mentions of 'site config'
* Allow height and width to be specified in options in CloudCoverUrl
* Allow height and width to be specified in options in social_image.rb
* Remove options from cloud_cover_url.rb in favor of social_image.rb
* Add double splat operator for height and width options in social_image.rb
* Add double splat operator to options in application_helper.rb
* Add options to call in article_serializer.rb
* Remove options from the CloudCOverUrl call in application_helper.rb
* Remove options from article_serializer.rb
* Add height and width variables to cl_image_path
* Remove hardcoded height and width from social_image.rb
* Adjust width to be 500 rather than 420 in social_image.rb
* Start with webhooks: table and model
* Start with webhooks api
* Start with webhooks api
* Webhook::Event class and events list
* Remove commented callbacks
* Start with sending events to webhook endpoints
* A couple of tests for Articles::Creator
* Send event to webhook endpoint on article destroy
* Dispatch event on article update
* Dispatch event when an article updated from admin
* Spec for the webhook job
* One more test for the dispatch event job
* Integration-like spec for event dispatching to webhook endpoints when creating an article
* Use Addressable::URI to parse endpoint url
* Add oj as a faster fast_jsonapi backend
* Renamed serializers
* Move article serialization out of a model
* Don't allow to create a webhook event with invalid type
* Add fields for ArticleSerializer
* Fix webhook event job specs
* Specify timeout when dispatching events
* Fix webhook job spec
* Change webhook events queue name
* Change serialized article fields for the dispatchable events
* Include user data when serializing an article for webhook event
* Moved decorating out of Webhook::DispatchEvent, fixed most specs
* Fix route in ArticleSerializer
* Move Article decoration to Webhook::PayloadAdapter
* Refactor image url helpers to avoid including helpers into serializer
* Fix specs
* Default url options for production