Commit graph

60 commits

Author SHA1 Message Date
Mac Siri
afa73e06e3
Replace Webpacker with Esbuild (#20470)
* Migrate to esbuild WIP

* Add exclude

* Remove redundant file

* Move file

* Move to javascript_include_tag

* Lint fix

* WIP

* WIP

* Add watch mode to esbuild WIP

* Get jest working

* Remove babel

* Revert "Remove babel"

This reverts commit 6da35260aa19d6f97f586deb66c0ecaf48433b73.

* More WIP

* Got image to load

* WIP

* Resolve audit

* Lint fix

* WIP

* Fix jest spec

* [CI] Remove asset-restore for test build stage

* Production compliant

* Temp disable sourcemap

* Update glob

* Add esbuild helper to stimulus

* Import fragment

* Temp disable coverage to see failing tests

* Fix broken spec

* Address lint

* Set proper es6 target

* Use esbuild for everything

* wait what

* Revert "Set proper es6 target"

This reverts commit 98f5278093421baa8ffe2ca580845b01c1a1eadf.

* Revert "Use esbuild for everything"

This reverts commit 0ac46738f07ffcb6af095ccb1ffa5e439b7fefa3.

* Replace uglifier with terser

* New compiled assets version

* Remvoe honeybadger-io/webpack

* Remove cypress coverage checks for now

* Update jsconfig.json

* Update docker-compose

* Remove public/packs-test from ci cache
2024-01-25 20:29:21 +00:00
Anna Buianova
455399bdba
Rubocop fixes (#18461)
* Rubocop fixes

* Fixed most Capybara/SpecificMatcher violations

* Moved flash notice texts to locales
2022-09-16 15:25:48 +03:00
Mac Siri
678dda8cf4
Routine Rubopcop lint fixes (#17844)
* Routine Rubopcop lint fixes

* Undo app_secrets_spec changes

* Fix broken spec
2022-06-07 10:17:16 -04:00
Michael Kohl
f471ba9bd6
Don't load ActiveJob railtie (#16074) 2022-01-12 22:29:54 +07:00
Mac Siri
a8c75fb0e8
Re-add dynamic delivery_method for ApplicationMailer (#13994) 2021-06-23 15:17:27 -04:00
Mac Siri
aba6033d9b
Revert dynamic email config changes (#13983)
* Add missing clear_cache in spec

* Fix broken spec

* Temporarily bring back old config

* Disable specs
2021-06-14 13:08:24 -04:00
Mac Siri
e38196df6f
Create Settings::SMTP (#13943)
* Fix typo

* Add SMTP configs to Settings::General

* Expand Settings's show page

* Expand Settings::General's constants

* Move smtp_enabled? logic to ApplicationMailer

* Apply suggestions from code review

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

* Add missing descriptions and placeholders

* Remove production guard clause

* Change delivery_method to a callback

* Create Settings::SMTP

* Run migration

* Move constants

* Remove SMTP from Settings::General

* Create SMTPSettingsController

* Add back guard clause

* Change which perform_deliveries configuration to use from

* Update config/environments/production.rb

* Rename migration to singular

* Run migration again

* Fix name

* Alphabetize and add validation for authentication

* Move settings and enabled? logic to Settings::SMTP

* Change after_action to before_action

* Fix broken spec

* Fix broken spec

* Create SMTP specs

* Provide default for port

* Create spec for ApplicationMailer

* Fix broken spec

* Move smtp_enabled?

* Search and replace

Co-authored-by: Ridhwana <Ridhwana.Khan16@gmail.com>
2021-06-14 10:29:43 -04:00
Mac Siri
5b8b651b67
Allow sign up without email smtp config (#13650) 2021-05-14 11:43:49 -04:00
Mac Siri
25f6b3e9ed
Convert SMTP configs into environments vars (#13542)
Co-authored-by: rhymes <rhymes@hey.com>
2021-05-03 16:32:15 -04:00
rhymes
b6360fb80c
Upgrade Rails to 6.1.3.1 (#11333)
* 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>
2021-04-05 10:39:48 -04:00
Ben Halpern
3c297ff05e
Lengthen local caching max-age (#11970) 2020-12-20 11:08:10 -05:00
Molly Struve
025c5213d1
Refactor:Remove Deprecated SENDGRID_USERNAME and SENDGRID_PASSWORD From production.rb (#11376) 2020-11-12 09:58:10 -06:00
rhymes
fe75dcde1c
Routine rubocop fixes (#10478) 2020-09-29 10:14:26 -04:00
Ben Halpern
3e09a7768f
[deploy] Remove need for ENV vars during asset precompile (#10349)
* Remove need for ENV vars during asset precompile

* Add open-search test
2020-09-16 13:57:05 -04:00
Ben Halpern
3a469a99e2
[deploy] Enable admin-configured app_domain (#10206)
* Move app_domain from env var to siteconfig *within app area*

* Fix SiteConfig

* Don't change URL.domain yet

* Not use in fastly cache purge yet

* Session store magoo

* Revert domain issue

* Add SetCookie middleware

* Temporarily remove cookie middleware and release tasks

* Re-enable SetCookieDomain

* Add some more comments, get it ready for testing

* Remove host from url options and temporarily show errors

* Allow forwarded host to be cookie

* Fix typo

* Change invalidAuthenticityToken

* Properly set app domain

* Proper Fastly cache

* Remove config.app_domain

* Remove config.app_domain

* Explicitely set remember_user_token

* More play with cookies

* Fiddle with remember_user_token

* Add remember_user_token changes

* Monkeypatch devise

* Sessions controller

* Include rememberable

* Include rememberable

* Proper cookie monkeypatch

* Proper cookie monkeypatch

* Proper cookie monkeypatch

* Remove extra cookie code

* User sign in tweak

* Close the loop

* Experiment with carrierwave public_url

* Finalize carrierwave monkeypatch

* Remove async controller specs

* Change some tests

* Update domain test

* Remove temporary production.rb change

* modify cookie logic

* Remove unneeded changes

* Remove unneeded changes

* Explicitely pass host

* Fix linting

* Fix social image test

* Add some cookie tests

* Modify article url

* Fix canonical urls

* Fix typo

* Remove sessions controller

* Remove devise monkeypatch

* Add monkeypatch

* Remove elsif

* Update spec/helpers/application_helper_spec.rb

Co-authored-by: Michael Kohl <citizen428@dev.to>

* Adjust remember_cookie_sync

* Remember user token experimentation

* Fiddle with devise

* Properly configure devise

* Fix typo

* Fix formatting issue

* Add comment about middleware

* Fix typo

Co-authored-by: Vaidehi Joshi <vaidehi.sj@gmail.com>

* Remove commented-out code

Co-authored-by: Michael Kohl <citizen428@dev.to>
Co-authored-by: Vaidehi Joshi <vaidehi.sj@gmail.com>
2020-09-11 09:38:34 -04:00
Molly Struve
268d2fc144
[deploy] Optimization:Default Production Logging to Error (#10025) 2020-08-26 16:15:29 -05:00
Molly Struve
00ad509c3a
[deploy] Update Sendgrid to Use API Key if Present (#9981) 2020-08-24 14:20:50 -05:00
Ben Halpern
244d632565
Check for heroku url presence before working with it (#9866) 2020-08-19 10:01:15 -04:00
Molly Struve
0a64ac067b
[deploy] Remove ENVied Gem, Use dotenv Take 2 (#9767) 2020-08-14 12:20:47 -05:00
rhymes
e727956640
Revert "[deploy] Refactor:Remove ENVied Gem, Use dotenv Instead for Test and Development (#9621)" (#9757)
This reverts commit 1be8c72206.
2020-08-12 13:28:38 -04:00
Molly Struve
1be8c72206
[deploy] Refactor:Remove ENVied Gem, Use dotenv Instead for Test and Development (#9621)
* Refactor:Remove ENVied Gem in Favor of Default application.yml

* Copy sample_application.yml for Travis

* Create .env_sample file, Warn of missing ENV variables, ignore .env file

* Use dotenv For ENV variables and create Rake Task to Populate

* Update docs to copy .env_sample file

* make application config a bit more resilient

* update more documentation and only initialize dotenv in dev and test

* Update doc code snippet types and refactor rake task and app config

* remove push defaults

* Make initializers more resilient, remove unused ENV from travis

* Exit new rake task if application.yml does not exist, include dotenv in docs
2020-08-12 11:01:38 -04:00
rhymes
cc8bfcb5c0
Enable Rubocop 0.89 cops and fix Lint/ violations (#9709)
* Enable new Lint/ cops and run rubocop -a

* Fixing last remaining things with rubocop -a

* Enable and fix Style/ExplicitBlockArgument and Style/GlobalStdStream

* Forgot parenthesis
2020-08-10 16:57:12 +02:00
Molly Struve
8f50c2246e
[deploy] Bug Fix:Hide To Email Field and Content Field on Ahoy Messages (#9634) 2020-08-05 12:02:28 -05:00
Molly Struve
e2e034b910
[deploy] Refactor:Remove No Longer Needed Timber Logging (#9555) 2020-07-28 14:00:38 -05:00
Molly Struve
7167587de5
[deploy] Feature:Allow Log Level to be Set with ENV Variable (#9456) 2020-07-25 16:46:48 -05:00
Molly Struve
25f739b389
[deploy] Optimization:Change Log Level in Prod to Info (#9257) 2020-07-10 15:51:11 -05:00
Molly Struve
628c16fd79
[deploy] Bug Fix: Setup STDOUT Logger bc we need it (#9256) 2020-07-10 14:25:21 -05:00
rhymes
8126c5c2c1
Rubocop: Address Metrics/BlockLength violations (#9246)
* Address Metrics/BlockLength violations

* Add jbuilder to package auto correct
2020-07-10 13:53:32 -04:00
Molly Struve
8377620e31
[deploy] Refactor:Use if/else When Selecting Production Log Strategy (#9224) 2020-07-10 11:53:48 -05:00
Mac Siri
9607549312
Use custom UglifierCompressor to enable source-maps (#9188) 2020-07-08 11:55:53 +02:00
Molly Struve
fbdce03712
[deploy] Feature: Filter Sensitive Data From Production Logs (#9181) 2020-07-07 09:49:57 -04:00
Ernesto Tagwerker
9ea3a8c67d
Upgrade to Rails 6.0 (#7658)
* 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>
2020-06-04 11:54:25 +02:00
Ben Halpern
a4a14a5377
[deploy] Make force_ssl an environment variable to make sure new communities can get proper ssl config. (#7090)
* Add conditional for redirect

* Force ssl

* Redis secure

* More push

* Add FORCE_SSL_IN_RAILS env var
2020-04-08 14:23:50 -04:00
Michael Kohl
99da2a0863
Run rails app:update for 5.2.4.2 (#6743) [deploy]
* Run rails app:update for 5.2.4.2

* Remove bin/update and disable ActiveStorage
2020-03-23 10:38:20 -04:00
Vaidehi Joshi
99c87d7a17
Replace WELCOMING_USER_ID with mascot_user_id (#6484) [deploy]
Co-authored-by: Vaidehi Joshi <vaidehi.sj@gmail.com>
Co-authored-by: Julianna Tetreault <32834804+juliannatetreault@users.noreply.github.com>

Co-authored-by: Julianna Tetreault <32834804+juliannatetreault@users.noreply.github.com>
2020-03-09 08:08:53 -07:00
Vaidehi Joshi
f71c8b16e7
Allow dynamic authoring of welcome notifications (#6045) [deploy]
* Add "Welcome" type to Broadcasts, allow dynamic "authoring" of Broadcasts

This adds a new `type_of` to the Broadcast model: "Welcome". As we begin to create a new "welcome notification" workflow, we'll categorize them by making them all of the same type.

This also adds a concept of a "welcoming user", which can be set via an ENV var. The WELCOMING_USER_ID will allow us to explicitly set (and change) which user in the database is the one that "sends" welcoming notification. In production, we plan for this to be dev.to/sloan.

* Allow WelcomeNotificationWorker to accept + send any kind of broadcast

This abstracts out the logic of deciding which broadcast to send from the woker into the calling method. This will help us send many different kinds of welcome notifications using one, resuable worker class.

* Raise if a Notification can't be created

* Add STAFF_USER_ID as an ENV var

This is in preparation for moving away from SiteConfig.staff_user_id, and replacing it with an ENV var. We will need to set this in production first, and then make a separate PR to replace all instances of staff_user_id with the newly-set ENV var.
2020-02-12 13:50:37 -08:00
Michael Kohl
6321fbac9c Add production verify stage to TravisCI config (#5621) 2020-01-27 14:15:22 -05:00
rhymes
1aee4202d8 Switch external redis_store to Rails supported redis_cache_store (#5282)
`redis_store` was initially introduced to switch sessions from the cookie store to Redis in https://github.com/thepracticaldev/dev.to/pull/4004. When we introduced a dual cache store in https://github.com/thepracticaldev/dev.to/pull/4991 we forgot to use the builtin Rails cache store - [ActiveSupport::Cache::RedisCacheStore](https://guides.rubyonrails.org/caching_with_rails.html#activesupport-cache-rediscachestore) - and instead kept using the external [ActiveSupport::Cache::RedisStore] which comes from the `redis-activesupport` gem included by `redis-rails`.

The gem `redis-activesupport` contains this disclaimer:

> Rails 5.2.0 includes a Redis cache store out of the box, so you don't really need this anymore if you're generating a new Rails application. We are no longer accepting new features for this gem, only pull requests for security and compatibility fixes will be accepted.

Other reasons to use the Rails builtin cache store, other than being supported and developed are the following:

- supports and uses `hiredis` as a client if installed:

22483b86a6/activesupport/lib/active_support/cache/redis_cache_store.rb (L12-L14)

- supports compressions for keys over 1kb (that can be configured)

- is evolved with Rails itself
2019-12-30 10:34:20 -05:00
Anna Buianova
dcfa6d29b8 Fix Rubocop lints (#5155) 2019-12-19 10:09:37 -05:00
Ben Halpern
630c1b7425
Migrate to streaming app shell via serviceworkers (#5020) [deploy]
* Initial work for streaming app shell way of using serviceworkers

* Close in on serviceworker adjustment finalization

* Add docs and loading indicator

* Remove useless code

* Don't run on API

* Update app/javascript/contentDisplayPolicy/hideBlockedContent.js

* Fix small details

* Don't run serviceworker.js code in test env

* Fix JS in serviceworker

* Move private keyword to proper place in async controller

* Change shell_version to HEROKU_SLUG_COMMIT

* Update caching config

* Add test for async_info/shell_version
2019-12-16 12:21:33 -05:00
Molly Struve
7c650dcb1c
Remove RedisRailsCache and replace with Rails.cache (#5059) [deploy] 2019-12-10 13:11:08 -06:00
Molly Struve
90712f61c6
Remove memcache dalli gem and setup code (#5057) [deploy] 2019-12-09 11:37:53 -06:00
Molly Struve
27e90cc404
Add ENV variable to flip on Redis for fragment cacheing (#5026) [deploy] 2019-12-06 13:08:15 -06:00
Molly Struve
ce1bc8d2a4
Revert "Setup dual Redis store for rolling over fragment cacheing to Redis (#4991)" (#5014) [deploy]
This reverts commit e871a01c01.
2019-12-05 14:03:41 -06:00
Molly Struve
e871a01c01
Setup dual Redis store for rolling over fragment cacheing to Redis (#4991) [deploy] 2019-12-05 13:19:01 -06:00
rhymes
c15d48265a Routine rubocop fixes (#4859) 2019-11-19 10:46:47 -05:00
Ryan Palo
4156f1f9de [deploy] Extract DEV specifics to Env variables (#4561)
* [WIP] Extract DEV specifics to Env variables

* [WIP] Fix sendgrid url that I accidentally changed.  Womp.

* Remove extra colon from 'variable' calls

* Trim :// off of app protocol

* Update Envfile TIMBER_LOGS default comment for accuracy

* Add API doc links for each service
2019-10-28 10:29:57 -04:00
rhymes
3194c3bacd Generate HTTPS urls (#4059) 2019-09-18 10:42:50 -07:00
Anna Buianova
4c9a40be41 Dispatch events to the webhook endpoints #3715 (#3872)
* 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
2019-09-07 13:17:45 -04:00
cyrillefr
4fd66372dc Enable Layout/AlignParameters (#2340)
Check if the parameters on a multi-line method call or definition are aligned.

Resolves: #2021
2019-04-08 18:47:34 -04:00