Prior to this commit, in test, we had two different answers to "what is
the host of this application?" For Rails generates
URLs (e.g. `root_url`) we would get one answer. For our custom
`URL.url("/")` we got another answer.
This resolves and patches that up.
Closes#16347
* In dashboard show api eager load collection with articles
* Dashboard Article Row view now loads collection to suppress bullet warning of eager loading
* schema file undelete description
* feat: v1 of the script
* Flesh out remaining enums under their categories
* complete UsersSettings data update script
* complete DUS for relevant attributes in users and profiles tables
* complete DUS for users_notification_settings
* alphabetize user_settings sql file
* safeguard against null values for "null: false" settings
* Set up actual UsersSettings DUS and specs files
* fix broken DUS script
* complete specs for UsersSetting DUS
* Address QA of specs
* complete specs for users_notification_settings DUS
* fix the typos (thanks Julianna!)
* begin implementation
* still building
* add missing attribute "email_membership_newsletter"
* complete sync code (except race condition for user profile)
* complete implementation, remains tests
* Address PR review and fix Travis fails
* remove superfluous Profile.new
* fix travis fails
* feat: update the users_notification_setting attributes from the user model
* feat: use the config fonts enums to display the fonts
* feat: loop through the keys
* fix profile = nil blowing up; add specs for notification_setting model
* remove unneeded spec
* remove feed validation until after sync code removed; fixes feed_import spec failures
* remove spec associated with feed_url validation in user_setting model
* fix failing spec 😅
* add TODO
* feat: set the user settings in the user controller and use it in the customization form
* feat: move some update logic to the users settings controller thats being used from customization
* feat: show the updated values form the users_settingd and not the user instance
* Generalize redirect back to current tab
* still trying to reflect changed theme upon refresh
* customizations take effect on refresh
* remove 'with_feed' scope from user model
Co-authored-by: Jamie Gaskins <jamie@forem.com>
* start with takeover for fields previously in profiles table
* Takeover code for `publishing_from_rss` section in Settings (#13914)
* implement takeover code part 1
* implement takeover code
* fix feed fetch
* need rhymes help
* complete implementation; specs pending
* fix STUPID omission that caused so many headaches 😫
* implement profile fields pointing to users_settings 🎉
* run migrations
* implement inbox type & guidelines takeover code; specs pending (#13911)
* Point changes in notification settings to `users_notification_settings` table (#13910)
* implement takeover code; remains specs
* address PR feedback; remove related sync code
* address PR review feedback
* need help with routing and specs
* address pr review
* addressing pr review
* Treat implementation edge cases and omissions 😅
* fix uncommented comment
* fixing implementation cases
* address more PR review feedback
* fixing notifications use-cases
* refactor settings controller
* more pr review changes
* solving bugs
* fix broken onboarding
* handle eperience_level calls
* more fixes
* remove unneeded mappings
* add To-dos for quety updates
* remove done TODO
* purge done TODOs
* update notification_settings-related queries
* start fixing specs
* fixing specs
* fix notification and lrg_forem specs
* fixing broken specs
* still fixing
* fix line dif and remove reloads from user.rb
* run specs
* silence bullet and other fixes
* remove setting migration scripts and specs, fix more settings for specs
* handle missing user for article builder and fix notification specs
* fix some final controller specs and re-add incorrectly removed specs
* remove deprecated data update scripts and related workers, put travis back
* refactor admin tags mods controller, write/move specs for users notifications settings controller
* schema cleanup and other small refactors for consistency
* set field we can invalidate in spec via active record instead of at the db level
* remove I think an uneccessary hook call from subscribe_to_mailchimp_newsletter
* use bnefore_create to setup settings, please dont blow up the test suite
* mailchimp bot fix
* remove decorator in favor of single model method
Co-authored-by: Arit Amana <msarit@gmail.com>
Co-authored-by: Ridhwana <ridhwana.khan16@gmail.com>
Co-authored-by: Arit Amana <32520970+msarit@users.noreply.github.com>
Co-authored-by: Jamie Gaskins <jamie@forem.com>
* Fix autoloading for RateLimitChecker
* Fix autoloading for ForemStatsClient
* Fix autoloading for middlewares
* Move things to their proper place
* Move middleware usage to the proper place
* Re-add rest-client in datadog driver correctly
* Already required in config/initializers/middlewares.rb
* Bring that back
* Fix Honeybadger spec
* Upgrade Rails to 6.1
* Switch to unreleased bullet
* Run rails app:update
* Add deprecation notices after reading changelogs
* Fix app:update error
* Move middleware in the correct place
* Temporarily disable ransack which does not support Rails 6.1
* Remove wrongly merged file
* Re-run spring binstub
* Fix double quotes
* Track ransack branch with Rails 6.1 support
* Fix deprecation
* Switch to Ransack 2.4 which supports Rails 6.1 rc1
* Fix missing default params for the duration substitution
* Fix new behavior of relation.pluck with contradictory queries
* Fix uploaders specs by tracking rspec-rails main repo
* Disable bullet temporarily
* Fix remaining fixture_file_upload usages
* Add default seconds for video article duration
* Trigger Travis CI
* Upgrade Rails to 6.1.0.rc2
* Remove file deleted on master
* Add Rails 6.1 gem to Gemfile
* Trigger Travis CI
* Revert "Disable bullet temporarily"
This reverts commit cee0c2ce61fb72cbc16d52c94b12ee681e873031.
* Fix bullet version
* Upgrade to acts-as-taggable 7 and fix conflict
* Update Gemfile and rspec-* gems
* Fix nokogiri in Gemfile.lock
* Switch to rspec-rails main branch
* Remove leftover vendored cached items
* Fix path for Rails 6.1
* Use latest release of erb_lint
* Re-run rails app:update to incorporate new changes
* Disable erb_lint's ErbSafety checks
* Fix Gemfile.lock and re-add platform specific gems of Nokogiri
* Add mini_portile2 as well
* Fix latest merge conflict by removing now unused faraday_middleware
* Upgrade to Rails 6.1.3.1
* Regenerate Gemfile.lock and vendor/cache
* Add x86_64 linux gem
* Mark spec as flaky
* Revert "Mark spec as flaky"
This reverts commit 3caba94b33645f9b59c84ba78ee8df042fc7aee0.
Co-authored-by: Mac Siri <krairit.siri@gmail.com>
* Update to Ruby 2.7.2
* Update remaining files
* Remove VERBOSE from development.rb and test.rb
* Update Ruby version for dependabot and docs
* Readd accidentally removed code
* Add dual booting logic to Gemfile
This might be helpful for the Rails 6.0 upgrade project.
* Add more than one gemfile to Travis' configuration
We want to see how the application behaves with more than one Rails versions:
- Gemfile -> Rails 5.2
- Gemfile.next -> Rails 6.0
This will help us figure out what needs to be addressed before migrating to Rails 6.0.
If you want to read more about this technique (dual booting) you can check out this page: https://www.fastruby.io/blog/upgrade-rails/dual-boot/dual-boot-with-rails-6-0-beta.html
* Fix joins
* Upgrade Gemfile.next.lock
* Make sure we're installing the correct versions of gems
* Add Rails 6 notes
* Update rubocop in Gemfile.next.lock
* Fix organization spec
* Fix page_views_spec
* Add Rails 6 and run rails app:update
* Remove some tricks
* Remove Gemfile.next for now
* Fix .content_type deprecation
* Fix deprecation of .where.not NAND/NOR behavior
* Fix deprecation of parameterized emails
* Fix specs
* Remove next flag for now
* Fix spec (hopefully)
* Add wait_for_javascript
* Fix spec, thanks @maestromac!
* Try without wait for javascript hack
* Remove unnecessary bin/update
* Remove file that snuck in the rebase
* Update the vendored gems
* Replace migrate+db:setup with db:prepare
* Update vendored gems
* Fix Gemfile.lock and update vendored stuff
* Fix Gemfile.lock to be the same as master's minus the changes
Co-authored-by: rhymes <rhymesete@gmail.com>
* Add 'top_comments' to article feed
* Only include root comments
* Cache and eagerly load top comments
* Clear top comments cache when article score is updated
* Add articles.top_comments to bullet whitelist
* Update app/models/article.rb
Co-Authored-By: rhymes <rhymesete@gmail.com>
* Remove limit in top_comments association, remove Rails caching of top comments
* Remove unnecessary test
Co-authored-by: rhymes <rhymesete@gmail.com>
* Upgrade to Ruby 2.7.0
* Upgrade Travis's Ruby as well
* Fix conflict
* Silence all Ruby 2.7 deprecation warnings in dev mode
* Silence dev and test unless CI
* Fix logging for dev and test environments
We had some unused code for Timber in our config files for development and test.
However, this was completely clobbering Rails' default behavior of logging out to log/development.log and log/test.log. We should allow for logging in these environments in particular, and since we're not using Timber there, we can just revert to using the Rails default debugging log levels.
* Add Timber logger to specs that explicitly require it
* Restore default Rails.logger in specs using Timber logger
* Explicitly use Rails.logger in OmniauthCallbacksController
We seem to have different logger classes leaking into this controller in tests.
I'm not entirely sure why this is/haven't been able to investigate yet, but I do think we should be using the Rails.logger explicitly until we can figure that out.
* 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
* Preload organization, not user
* Preload users only when needed
* Pre-load podcasts for podcast episodes in API
* Avoid eager loading error by loading rating votes separately
* Preload associations for moderation
* Preload user comments in trees
* Preload organization for non org dashboard and cleanup queries
* Optimize ArticleSuggester to only load N articles at need
* Remove eager loading and pass variables to partials for easier debug
* Reorganize tags validation code and ignore actsastaggableon eager loading issues
* Remove unused eager loading and bring up comments relation
* Preload podcasts when loading podcast episodes
* Fix views specs
* Make sure ArticleSuggester never returns duplicates
* Remove commented code
* Re-trigger build
* Move suggested articles back to view to respect fragment caching
Rails by defaults loads all its railties and engines, the current app does not use neither ActiveStorage, nor ActionCable nor TestUnit.
We can, hence, dispense of them.
* Improve a few idioms with their faster counterparts
* Remove unused routes and some dead code
* Add the option to use bullet in testing mode and move rack host redirect
* Go back to the classic fetch to make mocking work
* Reorder gems and fix code climate issue
* Replace Flipflop with Sail
* Address PR comments
* Bump sail version to latest
* Bump Sail to latest version
* Move setting creation to config/sail.yml
* Bump Sail to latest version
* Use correct limit for cast_type in schema
* Update Sail's route
* Initial automatic cleanup with rubocop
* Fix syntax error introduced by rubocop
* Cleanup seeds file
* Cleanup lib folder
* Exclude bin folder because it contains auto generated files
* Make Rubocop a little bit more chatty
* Block length should not include comments in the count
* Cleanup config folder
* Cleanup specs
* Updated Rubocop version and generated a todo file
* Fix broken ArticlesApi spec
* Fix tests
* Restored rubocop pre-commit hook