Commit graph

208 commits

Author SHA1 Message Date
Mac Siri
76de9a0317
[deploy] Replace #cloudinary with #optimized_image_url (#9876) 2020-08-21 14:46:00 -04:00
Vaidehi Joshi
9e40e68682
Allow Nginx cached static content to be purged (#9857) [deploy]
* Only bust_fastly_cache if fastly is enabled

* Conditionally bust nginx cache from CacheBuster#bust

* Don't _actually_ call out to openresty

* Remove redundant check for FASTLY_API_KEY in CacheBuster

* Clean up and add a spec

* Do not call .purge_ methods if fastly is not configured

* Add OPENRESTY_ ENV vars to .env_sample

* Remove extra / prepending path

* Remove ConfigurationError, clean up Purgeable concern

* Use raise instead of fail like fastly-ruby

* No longer check for Rails.env.production?

* Use let! to create article in BustMultipleCachesWorker spec
2020-08-21 09:31:23 -07:00
rhymes
99615705ca
[deploy] Add relations and foreign keys between Poll related models (#9854) 2020-08-20 11:14:54 +02:00
rhymes
a86f4c83f2
[deploy] Add relations and foreign keys between HtmlVariant related models (#9846)
* Add inverse has_many relation betwen User and Ahoy::[Event|Visit
]

* Add FKs and proper relations to HtmlVariant models
2020-08-18 11:33:38 -04:00
rhymes
f5d35c6506
Rubocop: Enable and fix Style/StringConcatenation (#9844) 2020-08-18 14:50:15 +02:00
Molly Struve
a16fc46f84
[deploy] Revert "Async Handle Notifications for Comments When Saved (#9680)" (#9686)
This reverts commit 852223dd86.
2020-08-08 20:16:27 -05:00
Molly Struve
852223dd86
[deploy] Async Handle Notifications for Comments When Saved (#9680) 2020-08-08 17:59:17 -05:00
Michael Kohl
26ee8f194c
Rubocop: Move from OpenStruct to Struct in Organization (#9431)
* Move from OpenStruct to Struct in Organization

* Add data update script

* Introduce Articles::CachedEntity model

* Update data update script for new model

* Fix comment

* Update jbuilder
2020-07-30 21:04:05 +07:00
rhymes
5a2cae4fbb
Rubocop: enable and fix new Rails cops (#9537)
* Enable new Rails/* cops and use autocorrect on them

* Fixed Rails/PluckInWhere leftovers

* Fix Rails/DefaultScope

* Enable and fix Rails/PluckId

* Fix manual mistake with forcing autocorrection on Rails/PluckId

* Apply PR feedback to remove Rails/PluckId inline disables

* Apply PR feedback to get rid of Rails/PluckInWhere inline
2020-07-29 11:14:19 +02:00
Ben Halpern
8d1a9e7a1c
Show article year if article published last year (#9547)
* Show article year if article published last year

* Fix tests
2020-07-28 10:32:20 -04:00
Michael Kohl
a4dadfb728
Standardize ActiveRecord order clauses (#9395)
* Change simple order clauses

* Change nested order clauses
2020-07-20 10:00:51 -04:00
rhymes
f1ec04a0c9
Rubocop: move dot in multi-line calls to leading position (#9262) 2020-07-16 15:51:11 +02:00
rhymes
5affc7c08c
[deploy] Revert "Rubocop: fix Performance/OpenStruct (#9241)" (#9291)
This reverts commit 101cca4a68.
2020-07-13 17:22:58 +02:00
rhymes
101cca4a68
Rubocop: fix Performance/OpenStruct (#9241)
* Fix Performance/OpenStruct in Article and Organization

* Fix Performance/OpenStruct in Notifications::Reactions::Send

* Add missing rubocop disable for Performance/OpenStruct

* Fix serialization
2020-07-11 10:13:18 +02:00
rhymes
5b62811c98
[deploy] Rubocop: fix violations of Layout/LineLength (#9197) 2020-07-08 08:36:36 -05:00
Alex
6df3e091d8
[deploy] Update PollTag (#9087)
* Update PollTag

* Remove old liquid_tags_used and add comment

* Update comment for clarity

* Remove old spec
2020-07-03 18:52:44 -04:00
Alex
347a4bbc75
[deploy] Add contexts and permissions to liquid tags (#8917)
* Make liquid tags adhere to context and permission

* Undo updates to all liquid tags and update error

* ACTUALLY update errors this time

* Typo

* Refactor error handling and add support for Comment

* Fix specs

* Code cleanup

* Prettify error message

* Add comment clarifying error

* parsed --> parse

* Use a policy for validating roles

* Fix pretty error message

* Return early if valid source

* Get rid of duplicate current_user

* Add comment to Pundit.authorize

* LiquidTagPolicy specs

* Update liquid tag docs

* Update docs

* Use parse_context argument for clarity

* Remove duplicate guard clause for VALID_ROLES

* Update docs
2020-06-30 14:53:18 -04:00
Alex
db4e37781f
[deploy] User subscriptions liquid tag MVP (#8871)
* UX (view, style, JS) progress

* base_data updates

* More JS updates

* Remove unnecessary param of author_id

* Remove author_id from controller

* Restrict email to admins

* Introduce profile images

* Remove base_data and update tag for source

* Use .key?

* I gotchu Codeclimate, don't worry :)

* Add click event listeners to modal buttons

* Refactor

* More refactor

* Refactor subscriber

* Use userData() for subscriber

* Reorganize

* Code cleanup

* Add subscription API call and favor textContent

* Fix API call and showSubscribed

* Add Apple Auth logic and change links to buttons

* Update success message

* Add Apple email check and spec

* Fix default sign in state

* Remove email from async_info :(

* Refactor markdown classes

* Single quote consistency

* Modal bug attempt & subscriber image on success

* Refactor passing source to tags and fix preview
2020-06-25 13:13:19 -04:00
Alex
8714a36d27
[deploy] User subscriptions API and backend updates (#8779)
* Create "blank" EmailSubscriptionTag

* Refactor liquid_tags_used with spec

* Create /user_subscriptions#create

- Update liquid tag name to UserSubscriptionTag

* Add rate limiting and specs

* Add counter_culture for user_subscriptions

* Update /async_info/base_data

- Alphabetize user_data
- Add email
- Add subscription_source_article_ids
- Cache subscription_source_article_ids on User model

* Add stale email check and specs

* Change user_email to subscriber_email for clarity

* Restrict UserSubscriptionTag

* Rename RESTRICTED_TAGS to RESTRICTED_LIQUID_TAGS

* Make TODO comment more clear

* Refactor error responses and update specs

* Update type to source_type in error message

* Use constantize over safe_constantize

* Add check for active source

* Refactor checking of current_user's subscriptions

- Remove data from async_info
- Create a new service to fetch/cache a user's existing subscriptions

* Restrict email in base_data to admin roles

* Oops! Rename liquid tag file

* Change error back to result...oops!

* It's not goodbye, it's see you later. RIP email :/

* Add current_email to /user_subscriptions/base_data

* Revert adding current_email

* Undo async_info_controller changes/fix conflict

* Move params to constant

* Refactor SubscriptionCacheChecker

* Remove duplicate status code in JSON response

* Remove duplicate status code for #subscribed

* Use response.parsed_body

* Remove user guard in SubscriptionCacheChecker
2020-06-23 13:43:32 -04:00
Alex
1890f393a2
[deploy] Add subscriber_email to user_subscriptions & more backend updates (#8723)
* Add migrations for subscriber_email column

* Add new schema

* Update relationships, specs, and factory

* Use unless index_exists? over if !index_exists?

* Fix typo in last fix for migration

* Rename authored_user_subscriptions

- to source_authored_user_subcriptions

* Add factory methods and specs

- UserSubscription.make
- UserSubscription.make_new
- Article.new_user_subscription
- Article.create_user_subscription

* Remove self and &

* Change make_new to build

* new_user_subscription --> build_user_subscription

* Come on, Travis
2020-06-18 14:40:08 -04:00
Alex
6af063eebf
[deploy] Email signups liquid tag backend (#8375)
* Backend MVP

- Migration
- Model
- Associations

* Add factory, spec, and validations

- Add unqiue index for validations

* Fix specs

* Add author to email_subscriptions

* Add user association to set_author_id

* Add clarifying comment to set_author_id

* Writing is hard sometimes

* Rename email_subscriptions to subscription_sources

* UserSubscription and user_subscription_sourceable

* subscribers --> sourced_subscribers

* Add comment to explain UserSubscription model
2020-06-15 09:33:34 -04:00
Mac Siri
1b839d9328
[deploy] Streamline Tag parsing for both editors (#8175) 2020-06-05 08:46:24 -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
Mac Siri
e812f995fe
[deploy] Remove redundant ActsAsTaggableOn::Taggable::Cache (#8102) 2020-05-29 10:27:13 -04:00
Ben Halpern
e39f5b04d1
[deploy] Render recently updated search preambled to sidebar (#8060)
* Render recently updated search preambled to sidebar

* Refactor

* Fix typo

* Mess with test
2020-05-26 18:34:27 -04:00
rhymes
0976132425
[deploy] RSS feed: add article tags as categories (#8046) 2020-05-26 15:51:33 -04:00
Andy Zhao
c42fd3461e
[deploy] Rename positive_reactions_count to public_reactions_count in logic (#7926)
* Rename positive_reactions_count to public_reactions_count

* Add positive reactions count back in so we can remove it

* Use public_category method for reactions

* Add positive_reactions_count in case any old caches rely on it

* Add positive_rxn_count to account for API endpoints

* Remove unused method

* One more spot...

* Add method back in because of caches

* Update specs to match new functionality

* Fix typo

* Remove unused methods
2020-05-26 12:36:28 -04:00
Molly Struve
1c461f8891
[deploy] Remove Unused Pro Memberships (#7894) 2020-05-20 11:54:30 -05:00
Anna Buianova
c4423adb19
Removed ignored_columns from articles (#7913) 2020-05-18 14:43:37 +03:00
Anna Buianova
70cfd6efc5
Remove code related to articles.live_now, added live_now to ignored_columns (#7846) 2020-05-14 14:35:43 -04:00
Michael Kohl
79f1f5f0c8
Change string concatenation to interpolation (#7680)
* Change string concatenation to interpolation

* Replace more concatenation with interpolation

* Add forgotten interpolation
2020-05-06 17:13:10 +02:00
Molly Struve
ee373fa6c0
[deploy] Remove Algolia from Article Model (#7540) 2020-04-28 09:55:48 -05:00
Molly Struve
984e2647e7
only run scoring, touch_collection, and update background callbacks on create and update (#7409) 2020-04-21 10:34:59 -04:00
Molly Struve
b10668a454
[deploy] Create a Bulk Index Elasticsearch Worker (#7265) 2020-04-15 09:08:59 -05:00
Josh Puetz
73c16c9a9d
[deploy] Tweak comments in feed (#7261)
* Only include needed fields for top comments

* Test for included user info in comments in feed

* Omit hidden and deleted comments from feed json

* Optimize selected columns from comment

* Revert field selection to prevent user n+1

* Add profile_image_90 to users in comments in feed
2020-04-14 15:23:14 -05:00
Josh Puetz
802e225a07
[deploy] Add top comments to articles feed (#6988)
* 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>
2020-04-13 10:21:03 -04:00
Molly Struve
b1ebc32e45
hook up data syncing for articles and switch to using call (#7115) 2020-04-07 09:39:23 +02:00
rhymes
f2b0be2043
Add Slack messengers: part 2 (#6916)
* Add Slack::Messengers::ArticlePublished

* Add Slack::Messengers::ReactionVomit

* Add Slack::Messengers::CommentUserWarned

* Add missing URL helpers

* Add Slack::Messengers::ArticleFetchedFeed

* Remove callback condition

* Build, don't create
2020-04-03 17:00:06 +02:00
Molly Struve
2f57952a1a
[deploy] Revert "serialize search score for articles (#7053)" (#7065)
This reverts commit e16a0f8c34.
2020-04-03 09:04:27 -05:00
Molly Struve
e16a0f8c34
[deploy] serialize search score for articles (#7053) 2020-04-02 17:34:03 -04:00
Vaidehi Joshi
e23e69d4b2
Prompt users to ask a question/start a discussion (#7007) [deploy]
* Add a discuss/ask notification(s) to seeds + factories

* Add a start discussion/ask question welcome notification

* Add a scope for finding articles published by a user + with a certain tag.

* Some clean up/refactoring in the generator

* Reorganize welcome notification sending, add specs for discuss/ask notification
2020-04-01 11:57:50 -07:00
Molly Struve
ef358c0213
[deploy] update articles when touched by reactions (#7001) 2020-04-01 13:26:56 -05:00
Molly Struve
ed90ddad10
Index Reading List Reactions (#6953)
* Index reactions when they are created and updated, remove when destroyed

* update reading list reactions when related article fields are updated

* create indexable method and use for indexing to elasticsearch
2020-03-31 12:23:43 -04:00
rhymes
4baa9d3165
Remove job_opportunities table (#6932) 2020-03-30 12:08:10 -04:00
rhymes
9a0a6fbe8f
Remove unused columns from articles (#6860) [deploy]
Co-authored-by: Ben Halpern <bendhalpern@gmail.com>
2020-03-27 17:04:13 +01:00
rhymes
d03c751c65
Rubocop fixes (#6904)
* Run rubocop -a

* Regenerate rubocop todo

* Fix Lint/UselessAssignment

* Fix RSpec/RepeatedDescription

* Fix Style/GuardClause

* Fix Style/NumericPredicate

* Regenerate rubocop todo
2020-03-27 15:30:59 +01:00
Ben Halpern
bc6a2f14c2
Revert rating_votes_count removal (#6851) 2020-03-25 18:20:09 -04:00
rhymes
f1167be64c
Ignore unused articles columns (#6781)
* Ignore unused article columns

* Remove usage of ignored columns
2020-03-25 17:48:42 -04:00
Mac Siri
84e84af8d7
Create Article#admin_published_with scope (#6794) 2020-03-24 18:15:43 -04:00
Molly Struve
7085082781
Add class_name to Elasticsearch ID field for Feed Content (#6729) [deploy] 2020-03-19 16:14:42 -05:00