docbrown/config/environments/development.rb
Rajat Talesra bbb9fd2e1e
Add more visibility to admins (part-2) (#19375)
* Basic thumbsup, thumbsdown and vomit

* Refined UI of flags and vomits

* If check

* Optimised code and added a method in article.rb

* Removed public keyword

* Nit fixes

* Section for flags and quality details

* Basic vomit item

* Quality item UI

* Separated code into partials

* UI changes and empty state added

* With correct implementation

* Fixed showing reaction items in all cases

* Dropdown visible

* Enabled click listerners and call functions for dropdown-button clicks

* Empty state UI fixed

* Tabs and divider UI

* Mark as valid/invalid conditions

* Nit fixes

* Logical fixes

* Added comments

* Partial item status update fix

* Reload page feature fixed

* Removed snackbar

* I18n strings

* Bug fix

* I18n strings

* Nit fixes

* Added date

* Added view details button

* Added view details test

* Sample test

* Test fixes

* Added tests for new article

* Flagged item tests added

* Added more tests

* Nit fix

* Suggested design changes

* Nit design fixes

* Tests with cy.intercept

* Nit fixes

* Nit fixes

* Hero Billboard Placement (#19467)

* init

* add option to swagger docs

* in_house validation

* filtered ad quesry changes

* styling and prioritizing home hero banner over campaign banner

* rubocop

* typo

* broken spec

* more spec fixes

* found the spec break culprit

* derp

* Update app/views/shared/_display_ad.html.erb

Co-authored-by: Ridhwana <Ridhwana.Khan16@gmail.com>

* Update app/controllers/stories_controller.rb

Co-authored-by: Ridhwana <Ridhwana.Khan16@gmail.com>

* remove immediate return

* styling feedback and moving banner to articles index

* remove nil

* updated styling

* add signed in bool

* add feature flag

* remove feature flag data scripts

---------

Co-authored-by: Ridhwana <Ridhwana.Khan16@gmail.com>

* Fix typo / erroneous word in Admin Section (#19488)

* Typo fixes

* Update admin_menu.rb

* Minor background and shadow change (#19501)

* Refresh audience segment for 'active' user (#19470)

* Refresh an individual user's segmentation

* Refresh segment if creating a published article

* Quick refactor

* Refresh segment if update publishing

* Quick refactor

* Refresh segment if update user settings

* Refresh segments after user update + role change

* Using latest_article_updated_at

* Sidekiq uses JSON for arguments, needs basic types

* Fix test issues with last_updated_at and sidekiq params

* Tests update continues

* Consolidate dependencies

* Method names acknowledging manual exclusive

* Fix test name copypasta

* Rubocop

* Try to clarify Creator#series

* Try to avoid naming predicate

* Remove erroneously included helper

* Improve onboarding “suggested tags” page design (#19475)

* Onboarding tags

* Logical design issue fixes

* Posts count added

* Checkbox design fixes

* Optimised css

* Nit fixes

* Test case added

* Reduced data

* Nit fix

* Added more tests

* Nit fix

* Tests updatedt

* Update @honeybadger-io/js to version 5.4.1 (#19479)

Co-authored-by: depfu[bot] <23717796+depfu[bot]@users.noreply.github.com>

* Update sidekiq-cron to version 1.10.1 (#19473)

Co-authored-by: depfu[bot] <23717796+depfu[bot]@users.noreply.github.com>

* Update nokogiri to version 1.15.0 (#19495)

Co-authored-by: depfu[bot] <23717796+depfu[bot]@users.noreply.github.com>

* use tabindex instead of disabled to get proper keyboard nav on /onboarding tags (#19513)

* Add billboard to safe param list in Fastly vcl (#19515)

* Removed static article id from setup

* All tests passing

* Nit fixes

* Nit fixes

* Fixed tests with Joshua's help

* Added trusted user related tests

* Fixed few tests

* Added intercept and wait

* Removed tab and enter key

* Updated comment

* Updated tests

---------

Co-authored-by: Lawrence <lawrence@forem.com>
Co-authored-by: Ridhwana <Ridhwana.Khan16@gmail.com>
Co-authored-by: Peter Frank <peter.kim.frank@gmail.com>
Co-authored-by: Joshua Wehner <joshua@forem.com>
Co-authored-by: depfu[bot] <23717796+depfu[bot]@users.noreply.github.com>
Co-authored-by: Ben Halpern <bendhalpern@gmail.com>
2023-05-26 19:15:12 +05:30

165 lines
7.2 KiB
Ruby
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

require "active_support/core_ext/integer/time"
# rubocop:disable Metrics/BlockLength
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# In the development environment your application's code is reloaded any time
# it changes. This slows down response time but is perfect for development
config.cache_classes = false
# Do not eager load code on boot.
config.eager_load = false
# Show full error reports.
config.consider_all_requests_local = true
# Enable server timing
config.server_timing = true
config.cache_store = :redis_cache_store, { url: ENV.fetch("REDIS_URL", nil), expires_in: 1.hour.to_i }
# Enable/disable caching. By default caching is disabled.
# Run rails dev:cache to toggle caching.
if Rails.root.join("tmp/caching-dev.txt").exist?
config.action_controller.perform_caching = true
config.action_controller.enable_fragment_cache_logging = true
config.public_file_server.headers = {
"Cache-Control" => "public, max-age=#{2.days.to_i}"
}
else
config.action_controller.perform_caching = false
config.cache_store = :null_store
end
# Don't care if the mailer can't send.
config.action_mailer.raise_delivery_errors = false
config.action_mailer.perform_caching = false
# Print deprecation notices to the Rails logger.
config.active_support.deprecation = :log
# Raise exceptions for disallowed deprecations.
config.active_support.disallowed_deprecation = :raise
# Tell Active Support which deprecation messages to disallow.
config.active_support.disallowed_deprecation_warnings = []
# Raise an error on page load if there are pending migrations.
config.active_record.migration_error = :page_load
# Highlight code that triggered database queries in logs.
config.active_record.verbose_query_logs = true
# Allows setting a warning threshold for query result size.
# If the number of records returned by a query exceeds the threshold, a warning is logged.
# This can be used to identify queries which might be causing a memory bloat.
config.active_record.warn_on_records_fetched_greater_than = 1500
# Debug mode disables concatenation and preprocessing of assets.
# This option may cause significant delays in view rendering with a large
# number of complex assets.
config.assets.debug = false
# Asset digests allow you to set far-future HTTP expiration dates on all assets,
# yet still be able to expire them through the digest params.
config.assets.digest = false
# Suppress logger output for asset requests.
config.assets.quiet = true
# Raises error for missing translations.
config.i18n.raise_on_missing_translations = true
# Annotate rendered view with file names.
# @note [@msarit] Changed to false as annotations broke embeds
config.action_view.annotate_rendered_view_with_filenames = false
# Adds additional error checking when serving assets at runtime.
# Checks for improperly declared sprockets dependencies.
# Raises helpful error messages.
config.assets.raise_runtime_errors = true
config.hosts << ENV["APP_DOMAIN"] unless ENV["APP_DOMAIN"].nil?
if (gitpod_workspace_url = ENV.fetch("GITPOD_WORKSPACE_URL", nil))
config.hosts << /.*#{URI.parse(gitpod_workspace_url).host}/
end
if (uffizzi_url = ENV.fetch("UFFIZZI_URL", nil))
config.hosts << /.*#{URI.parse(uffizzi_url).host}/
end
config.app_domain = ENV.fetch("APP_DOMAIN", "localhost:3000")
config.action_mailer.delivery_method = :smtp
config.action_mailer.perform_deliveries = true
config.action_mailer.default_url_options = { host: config.app_domain }
config.action_mailer.smtp_settings = {
address: ENV.fetch("SMTP_ADDRESS", nil),
port: ENV.fetch("SMTP_PORT", nil),
authentication: ENV["SMTP_AUTHENTICATION"].presence || :plain,
user_name: ENV.fetch("SMTP_USER_NAME", nil),
password: ENV.fetch("SMTP_PASSWORD", nil),
domain: ENV["SMTP_DOMAIN"].presence || config.app_domain
}
config.action_mailer.preview_path = Rails.root.join("spec/mailers/previews")
config.public_file_server.enabled = true
# Use an evented file watcher to asynchronously detect changes in source code,
# routes, locales, etc. This feature depends on the listen gem.
config.file_watcher = ActiveSupport::EventedFileUpdateChecker
# Debug is the default log_level, but can be changed per environment.
config.log_level = :debug
# Uncomment if you wish to allow Action Cable access from any origin.
# config.action_cable.disable_request_forgery_protection = true
if ENV["RAILS_LOG_TO_STDOUT"].present?
logger = ActiveSupport::Logger.new($stdout)
logger.formatter = config.log_formatter
config.logger = ActiveSupport::TaggedLogging.new(logger)
end
config.after_initialize do
# See <https://github.com/flyerhzm/bullet#configuration> for other Bullet config options
Bullet.enable = true
Bullet.add_footer = true
Bullet.console = true
Bullet.rails_logger = true
Bullet.add_safelist(type: :unused_eager_loading, class_name: "ApiSecret", association: :user)
# acts-as-taggable-on has super weird eager loading problems: <https://github.com/mbleigh/acts-as-taggable-on/issues/91>
Bullet.add_safelist(type: :n_plus_one_query, class_name: "ActsAsTaggableOn::Tagging", association: :tag)
# Suppress incorrect warnings from Bullet due to included columns: https://github.com/flyerhzm/bullet/issues/147
Bullet.add_safelist(type: :unused_eager_loading, class_name: "Article", association: :top_comments)
Bullet.add_safelist(type: :unused_eager_loading, class_name: "Article", association: :collection)
Bullet.add_safelist(type: :unused_eager_loading, class_name: "Article", association: :distinct_reaction_categories)
Bullet.add_safelist(type: :unused_eager_loading, class_name: "Comment", association: :user)
# There were some warnings about eager loading the organization for a display ad, however since the code goes down
# different paths (in_house where we dont need the organization info vs external/community where we need the
# organization info), bullet was getting confused on whether we need the eager loading or not.
Bullet.add_safelist(type: :unused_eager_loading, class_name: "DisplayAd", association: :organization)
# TODO: Temporarily ignoring this while working out user - profile relationship
Bullet.add_safelist(type: :n_plus_one_query, class_name: "User", association: :profile)
Bullet.add_safelist(type: :unused_eager_loading, class_name: "FeedbackMessage", association: :reporter)
Bullet.add_safelist(type: :unused_eager_loading, class_name: "Article", association: :reactions)
Bullet.add_safelist(type: :unused_eager_loading, class_name: "Reaction", association: :user)
# Check if there are any data update scripts to run during startup
if %w[Console Server DBConsole].any? { |const| Rails.const_defined?(const) } && DataUpdateScript.scripts_to_run?
Rails.application.load_tasks
puts "Running data updates..." # rubocop:disable Rails/Output
Rake::Task["data_updates:run"].invoke
end
end
end
Rails.application.routes.default_url_options = { host: Rails.application.config.app_domain }
# rubocop:enable Metrics/BlockLength