Commit graph

404 commits

Author SHA1 Message Date
Fernando Valverde
aa130cc456
Fix Honeybadger typo in Rpush reflection callback (#18071) 2022-07-13 09:13:40 -06:00
Mac Siri
9599d3349f
Enable framework 7's cache_format_version (#18064) 2022-07-12 15:44:23 -04:00
Mac Siri
5579f3360c
Add DD service name for active_support and active_record (#18060) 2022-07-11 10:14:42 -04:00
Mac Siri
390cf0a6a0
Enable Rails 7 framework's default_headers (#18042) 2022-07-07 09:01:59 -04:00
Mac Siri
294fcba1e0
Add service_name scope to Datadog (#17996)
* Add service_name scope to datadog

* Fix typo

* Update config/initializers/datadog.rb
2022-07-01 11:32:45 -04:00
Mac Siri
9dd52c24e1
Enable Rails 7's framework wrap_parameters_by_default & cookies_serializer (#17984) 2022-06-27 09:33:37 -04:00
Fernando Valverde
8c836430ca
API V1 transition (#17835)
* API Articles v0-v1 restructure

* Remove unused helper

* Bulk move API controllers into concerns + add V1 controllers

* Extract API routes + some fixes

* Fix v1 api_controller authenticate! + add more article_controller specs

* Completed spec/requests/api/v1/articles_spec.rb

* specs up to listings

* All v1 specs except for 9 skips

* mime_types cleanup + authenticate! relocation

Co-authored-by: Fernando Valverde <fernando@visualcosita.com>
2022-06-23 14:26:00 -06:00
Mac Siri
2f029fe896
Enable Rails framework 7.0's isolation_level, partial_inserts, & raise_on_open_redirects (#17970) 2022-06-23 10:30:58 -04:00
Mac Siri
130b47e8b8
Enable Rails framework 7.0's TimeWithZone & scope-inversing (#17958) 2022-06-22 09:33:38 -04:00
Mac Siri
eed1946e8c
Enable Rails framework 7.0's ActionView & tests (#17948)
* Enable Rails framework 7.0's tests configs

* Enable action_view configs
2022-06-16 17:18:21 -04:00
Mac Siri
80d9b969bd
Enable Rails framework 7.0's ActiveStorage & ActionMailer (#17931) 2022-06-16 10:49:56 -04:00
Mac Siri
dc55db5708
Change Rails load_defaults to 6.1 (#17877) 2022-06-13 10:40:53 -04:00
Mac Siri
686be06009
Enable cookies_same_site_protection :lax (#17875) 2022-06-09 16:04:39 -04:00
Mac Siri
a87f70048c
Enable some Rails 6.1 framework default part2 (#17855)
* Enable form_with_generates_remote_forms and deliver_later_queue_name

* Change form_with_generates_remote_forms to true

* Move config to application.rb

* Enable urlsafe_csrf_tokens

* Update comment
2022-06-08 10:56:10 -04: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
Mac Siri
fc9bfda0ce
Enable/remove some Rails 6.1 framework default (#17831)
* Default Rails 6.1's active_record & active_storage config

* Remove active_storage and action_mailbox from 6.1 default
2022-06-07 08:42:10 -04:00
Fernando Valverde
21103696c3
Add missing explicit scopes to Omniauth adapters (#17761)
* Add missing scopes to Omniauth adapters - explicit > implicit

* Trigger CI
2022-05-25 09:56:13 -06:00
dependabot[bot]
17955537e7
Bump ddtrace from 0.54.2 to 1.0.0 (#17662)
* Bump ddtrace from 0.54.2 to 1.0.0

Bumps [ddtrace](https://github.com/DataDog/dd-trace-rb) from 0.54.2 to 1.0.0.
- [Release notes](https://github.com/DataDog/dd-trace-rb/releases)
- [Changelog](https://github.com/DataDog/dd-trace-rb/blob/master/CHANGELOG.md)
- [Commits](https://github.com/DataDog/dd-trace-rb/compare/v0.54.2...v1.0.0)

---
updated-dependencies:
- dependency-name: ddtrace
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* Apply configurationa update

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Mac Siri <krairit.siri@gmail.com>
2022-05-18 15:46:49 -04:00
Mac Siri
215bf4abe6
Update datadog.rb to include env scope (#17667) 2022-05-12 18:13:20 -04:00
Mac Siri
fc188a0759
Simplify ddtrace configuration (#17665) 2022-05-12 15:19:47 -04:00
Mac Siri
8d39d22d9e
Revert "Bump ddtrace from 0.54.2 to 1.0.0 (#17560)" (#17643)
This reverts commit eeed96cf9c.
2022-05-12 09:28:50 -04:00
dependabot[bot]
eeed96cf9c
Bump ddtrace from 0.54.2 to 1.0.0 (#17560)
* Bump ddtrace from 0.54.2 to 1.0.0

Bumps [ddtrace](https://github.com/DataDog/dd-trace-rb) from 0.54.2 to 1.0.0.
- [Release notes](https://github.com/DataDog/dd-trace-rb/releases)
- [Changelog](https://github.com/DataDog/dd-trace-rb/blob/master/CHANGELOG.md)
- [Commits](https://github.com/DataDog/dd-trace-rb/compare/v0.54.2...v1.0.0)

---
updated-dependencies:
- dependency-name: ddtrace
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* Update config file for 1.0:

* Use Tracer class for 1.0

* Re-enable priority sampling

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Josh Puetz <hi@joshpuetz.com>
2022-05-05 06:57:43 -06:00
Ridhwana
e72957a913
feat: add an inflection and change instances of gdpr to GDPR (#17567) 2022-05-04 16:20:46 +02:00
Daniel Uber
4d33486e14
Enable string uuid as namespace (#17309)
* Enable string uuid as namespace

This addresses a noisy deprecation warning showing in specs (it points
to our re-implementation of warden's sign_in_as helper, but I suspect
the issue is within warden since our initializer seems to match the
implementation in the upstream gem).

My understanding of this is that the prior default had been to pass
the provided uuid namespace as-is if it didn't match one of a few
named constants. New behavior is to validate that any string provided
as a namespace looks like a uuid representation or fail).

* Move configuration change to framework defaults
2022-04-20 10:24:25 -05:00
Arit Amana
5cf2229b58
Better Error Msg when Listing URL embedded and Listings are disabled (#17116)
* complete implementations and specs

* remove unused error msgs

* add "listing" and "listings" as ReservedWords
2022-04-06 08:38:53 -04:00
Michael Kohl
33195929aa
Bump to Rails 7.0.2.2 MVP (#15908)
* Update gems

* Update more gems

* Update @rails/ujs package

* Explicitly add sprockets-rails

* Gemfile update

* Run bin/rails app:setup

* Update redis-actionpack

* Update stats initializer autoloading

* Update acts-as-taggable-on

* Disable signed: true option in session store

* Switch back to released version of redis-actionpack

* Update Gemfile.lock

* WIP

* Update Rails and gems

* Move hair_trigger back to released gem

* Add explicit requires to initializers

* Update Rails version

* Add more explicit require_relative calls

* Re-enable ForemStatsDriver

* Update schema

* Temp spec changes

* Bullet started raising errors?

* Fix broken spec

* Temporarily disable hair_trigger_spec

* Refactor

* Fix spec

* Enable use_rfc4122_namespaced_uuids

* Revert "Enable use_rfc4122_namespaced_uuids"

This reverts commit 5dac3722284bb08049586bfa943405f8a01289df.

* Temporarily deploy to canary

* Revert "Temporarily deploy to canary"

This reverts commit 04f8469501fab2a3177450baf051ff6259c41827.

* Update Containerfile

* Add comments to specs

Co-authored-by: Mac Siri <krairit.siri@gmail.com>
2022-03-30 15:00:33 -04:00
Jamie Gaskins
5dc11719be
Instrument AS::Cache#fetch_multi in Honeycomb (#17023)
See:
- https://api.rubyonrails.org/classes/ActiveSupport/Cache/Store.html#method-i-fetch_multi
- https://guides.rubyonrails.org/v6.1.4.7/active_support_instrumentation.html#cache-fetch-hit-active-support
2022-03-28 13:37:26 -04:00
Mac Siri
63b5c9102d
Remove ForemStatsDriver abstraction (#16835)
* Remove ForemStatsDriver abstraction

* Remove stats.rb
2022-03-09 14:18:29 -05:00
Michael Kohl
e1bce8c398
Update device_detector, remove warning workaround (#16665)
Co-authored-by: Dan Uber <dan@forem.com>
2022-02-23 10:13:21 +07:00
Michael Kohl
a7a3d6d3e7
Ignore device_detector warnings (#16432) 2022-02-08 10:35:26 +07:00
Jamie Gaskins
a9cdb2bae2
A suspended user returns 403 instead of 500 (#16408) 2022-02-04 09:42:23 -05:00
Daniel Uber
4b4d8a7234
Ensure arguments to perform_async are json safe (#16285)
* Convert symbol hash keys to strings when calling .perform_async

Fixes a warning from Sidekiq 6.4.0+ about perform_async arguments
which are not equal when passed to perform (`JSON.parse(JSON.dump(arg))`
should equal arg).

This is a safety measure to prevent passing objects (like classes, or
model instances) rather than their representations (like a class name,
or a model's attributes hash).

This warning will be an error in sidekiq 7

* Turn warning into an error in non-production environments

* Use string keys for reaction notification and article fetched

Missed these two on the first pass

* Update example argument hashes for #enqueues_on_correct_queue

Since this calls perform_async under the hood we need to pass json
safe hashes in the test cases as well.

https://github.com/forem/forem/blob/main/spec/workers/shared_examples/enqueues_on_correct_queue.rb

* Convert keys from FollowData#to_h to string before perform_async

I'm not sure enough where else (outside of notification) to_h is being
called, so I'm converting here when building args, rather than in
FollowData#to_h, which might be my next step.

* Let FollowData#to_h return a hash with string keys

Update spec to use string keys as well.

* Make to_h return string keys for ReactionData

Like FollowData, the #to_h method is only used to call
notifications (this is used to enqueue sidekiq jobs).

* Remove a key that was in the hash

Since reaction_data calls to_h, it gets string and not symbol,
keys. Call Hash#except with a key that was actually there.
2022-01-25 18:07:40 -06:00
Fernando Valverde
41e6b7f858
Add host tag in ForemStatsClient (#16237)
* Add host tag in ForemStatsClient

* fix error in host tag
2022-01-21 08:27:42 -06:00
Jamie Gaskins
ebdaaaf15b
Revert "Support alternate S3 endpoints" (#16173) 2022-01-18 14:11:18 -05:00
Jamie Gaskins
8bdb2b6d8b
Support alternate S3 endpoints (#15445)
* Support alternate S3 endpoints

* Add missing comma

This is why we should use trailing commas

* Provide sample S3 endpoint config

* Comment out S3 image-storage config in .env_sample

See https://github.com/forem/forem/pull/15445#discussion_r754525723
2022-01-18 11:34:42 -05:00
Michael Kohl
fef3001bfe
Reconfigure session store, upgrade redis-actionpack (#16088) 2022-01-14 11:02:43 -05:00
Josh Puetz
629c7114da
Login with Google (#15986) 2022-01-13 10:25:52 -06:00
Michael Kohl
3143febb4b
Enable safe Rails 6.1 defaults (#16045) 2022-01-12 10:12:51 +07:00
Michael Kohl
6c26a8b40e
Update framework defaults (#15988)
* Update framework defaults to 6.0

* Update application.rb
2022-01-10 13:35:28 -05:00
dependabot[bot]
2d98e3346b
Bump rubocop from 1.23.0 to 1.24.0 (#15872)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Michael Kohl <me@citizen428.net>
2021-12-27 10:04:59 -05:00
Michael Kohl
872b007c30
Remove Doorkeeper gem (#15749) 2021-12-21 12:29:58 +07:00
Mac Siri
dfb0d0300c
Monkey-patch instead of forking cypress-rails gem (#15797) 2021-12-16 11:36:45 -05:00
Josh Soref
5324eb1477
Spelling fixes to live code (#15670)
Co-authored-by: Josh Soref <jsoref@users.noreply.github.com>
2021-12-06 12:11:25 +02:00
Jeremy Friesen
61b94b5176
Renaming method to reduce surprise (#15632)
Given that we have the roles of `:tech_admin`, `:admin`, and
`:super_admin`, I don't want the surprise of assuming that `user.admin?`
means that they have the role of `:admin`.
2021-12-01 16:38:26 -05:00
Michael Kohl
09828853f6
✂✂✂ Remove Connect (#14734)
* Remove Connect

* Remove more Connect specs

* Remove a lot more Connect code

* 🚮

* It all has to go

* Explicitly add httpclient

* Update application layout

* Remove messages association from User

* Start fixing specs

* reintroduce util function and refactor references

* Remove Connect Cypress test

* Fix more specs

* Remove Connect from listings

* Ignore contact_via_connect column on listings

* Remove contact_via_connect usages

* Ignore mod_chat_channel_id on tags

* Drop Connect tables

* Remove email_connect_messages from user notification settings

* Re-add httpclient 2.8.3

This was mistakenly removed as a merge conflict

* Don't need to exclude removed chat channel file

* Remove unneeded style for chat channels

* Remove unneeded channel list prop type

* Remove chat channels index/connect-link from getPageEntries

* Re-add comment from httpclient in Gemfile

* Remove connect references from mailers

Tag Moderators no longer have a chat channel

No longer will users be notified about new messages (there won't be
any)

No longer will users be notified about channel invites (you can't
invite anyone anymore)

* Don't configure Pusher and remove PUSHER_* from .env_sample

since it's removed from gemfile, the Pusher constant will not resolve, if this is
configured in the environment variables we'll fail to boot.

Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
Co-authored-by: Dan Uber <dan@forem.com>
2021-11-18 08:21:00 -06:00
Michael Kohl
1458b3ef56
[15-minute fix] Add js-routes gem (#15133)
* Add js-routes gem

* Update config/initializers/js_routes.rb

Co-authored-by: Suzanne Aitchison <suzanne@forem.com>

* Remove routes form base.jsx

Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
2021-11-01 10:08:15 +07:00
Jamie Gaskins
32ee50f278
Fix Sitemap for tags (#14989)
Set a NOT NULL constraint on tags timestamps

This commit also monkeypatches in a method for StrongMigrations to
disable a check temporarily. This migration is safe enough for DEV (it's
not ideal, but it'll only lock the table for a matter of milliseconds),
so we'll be fine disabling it but we don't want to disable the check
globally for all migrations in case there's a migration where this is
not safe.
2021-10-08 15:25:04 -04:00
Jamie Gaskins
8e220dc97f
Add Rails cache instrumentation to Honeycomb (#14880)
It looks like Honeycomb uses ActiveSupport notifications to instrument
applications, based on the names of the `notification_events`. I pulled
this event name from the Rails guides:

https://guides.rubyonrails.org/active_support_instrumentation.html#active-support
2021-10-06 10:46:24 -04:00
Fernando Valverde
c74121b0c0
Forem passport (cont) (#14759)
* Initial forem omniauth strategy setup work

* Finish basic raw proof of concept

* Some playing around

* use OAuth payloads + PASSPORT_OAUTH_URL for local dev

* Use FeatureFlag for Forem Passport Auth

* Working on tests

* Fix tests 🤞🏼 & some cleanup

* Use correct namespace within lib directory (match class namespace)

* Test to ensure Forem Passport auth is restricted by FeatureFlag

* Add broadcast + work on tests

* Update spec/lib/data_update_scripts/insert_forem_connect_broadcast_message_spec.rb

Co-authored-by: Michael Kohl <citizen428@forem.com>

* Hash format

* Schema cleanup + inline comments

* Use temprorary Heroku domain

* More cleanup

* Missed one

* Back to passport.forem.com

* Require correct path in lib

* Apply suggestions from code review

Co-authored-by: Michael Kohl <citizen428@forem.com>

* Use with_indifferent_access for symbol hash access in Forem strategy

Co-authored-by: benhalpern <bendhalpern@gmail.com>
Co-authored-by: Michael Kohl <citizen428@forem.com>
2021-09-30 06:47:45 -06:00
Jamie Gaskins
5fc3f52299
Allow caching feature flags for a given duration (#14668)
This duration is specified in the `CACHE_FEATURE_FLAGS_SECONDS`
environment variable. It can't be updated without restarting the
application.
2021-09-07 10:19:29 -04:00