Commit graph

485 commits

Author SHA1 Message Date
Brunno Souza
00b9d0ea12
Refactoring ChatChannel - distributing into services (#9253) 2020-08-07 10:41:34 +02:00
Alex
c988481004
[deploy] Cleanup preferred_languages language_settings for users (#9641)
* Cleanup language settings for users

* Remove logic for old language format

* Make preferred_langagues_array.include? nil safe
2020-08-06 10:00:01 -04:00
Michael Kohl
e9bbcbb789
[deploy] Add ProfileField model (#9580)
* Add ProfileField model

* Fix schema.rb

* Fix schema.rb again

* Fix validation
2020-08-03 16:16:50 -04:00
Andy Zhao
3df3d32b1c
[deploy] Revert "[deploy] Prevent signing up with no email (#9584)" (#9614)
This reverts commit a95a5723d1.
2020-08-03 16:16:20 -04:00
Andy Zhao
a95a5723d1
[deploy] Prevent signing up with no email (#9584)
* Prevent user email from being blank if new user

* Update error message

* Fix tests to handle new blank email user
2020-07-31 17:32:59 -04:00
rhymes
864b13b9ab
[deploy] Rubocop: fix Rails/HasManyOrHasOneDependent for Ahoy::Visit and Badge (#9565)
* Fix Layout/EmptyLines

* Fix Rails/HasManyOrHasOneDependent for Ahoy::Visit

* Fix Rails/HasManyOrHasOneDependent for Badge
2020-07-31 11:43:50 -04:00
Michael Kohl
6edb476acd
[deploy] Remove UserOptionalField (#9579)
* Remove UserOptionalField

* Remove optional fields from user and users factory

* Remove optional fields from user spec
2020-07-31 09:59:48 -04:00
Alberto Pérez de Rada Fiol
115adbb1bd
[deploy] Add index and show pages for series (#9201)
* Add index and show pages for series

* Address code review

* Use `id` instead of `slug` to get collections

* Extract `collection_link` into the application helper

* Only count published articles

* Get rid of the `collection_link_class` method

* Add tests

* Fix test

* Use `**kwargs` instead of `options = {}`
2020-07-29 10:01:52 -04:00
Molly Struve
b40af82b66
Flaky Spec Fix:Remove let_it_be Test Prof Helper (#9556)
* Flaky Spec Fix:Remove let_it_be Test Prof Helper

* Spec cleanup and fixes
2020-07-29 11:31:01 +02: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
Molly Struve
f84f88f9bf
Flaky Spec Fix:Remove let_it_be usage from Comment Model Spec (#9529) 2020-07-26 17:22:51 -05:00
Molly Struve
bc5e114ce9
Flaky Spec Fix:Remove let_it_be To Prevent Bad Database State Failing Specs (#9512) 2020-07-26 12:32:32 -05:00
Molly Struve
330009995d
[deploy] Optimization:Index Chat Channel Memberships Async on Message Creation (#9491) 2020-07-24 09:52:42 -05:00
Andy Zhao
9bdef4d4ae
[deploy] Update /ban for Connect (#9459)
* Rough MVP of /ban v2

* Make snackbar dismissable

* Make unban work

* Clean up response for happy and sad paths

* Fix tests

* Fix policy spec
2020-07-23 09:49:54 -04:00
Molly Struve
91c6541f57
Bug Fix:Validate User Password Length is Between 8-100 characters (#9447) 2020-07-22 11:40:23 -04:00
Molly Struve
62d43a1ce7
[deploy] Refactor: Remove Block Model and All Related Code (#9370) 2020-07-17 15:32:39 -05:00
rhymes
f1ec04a0c9
Rubocop: move dot in multi-line calls to leading position (#9262) 2020-07-16 15:51:11 +02:00
Alex
204fb51f14
[deploy] Remove path redirects (#9350)
* Remove path_redirect menu item

* Remove path_redirects_controller

* Remove path_redirect routes

* Remove PathRedirect model

* Remove internal views

* Remove path_redirects from seed file

* Remove PathRedirect factory

* Remove specs

* Migration to drop table and update schema
2020-07-16 09:35:42 -04:00
Ben Halpern
da6a6739e5
[deploy] Invite users to join and create password (#9294)
* Initial invitation work

* Add more invitation code

* Add proper registration page

* Fix up tests

* Fix failings

* Fix spec

* Add self-serve auth config

* Add registered condition

* Change profile image call and registered_at test

* Change comment

* Fix copy test

* Stub emojipedia

* Linting

* Add registered at to factory

* Ensure registered for user tag

* Update app/views/internal/invitations/index.html.erb

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

* Update app/controllers/internal/invitations_controller.rb

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

* Slight changes

* Update recover password flow

* Update app/views/internal/invitations/index.html.erb

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

* Update app/controllers/internal/invitations_controller.rb

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

* Update db/schema.rb

Co-authored-by: Michael Kohl <citizen428@dev.to>
2020-07-15 11:37:19 -04: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
Molly Struve
fad259b1c8
[deploy] Bug Fix: Remove Rails Validation for Follow Uniqueness, Guard against dup Follow Jobs (#9222) 2020-07-09 09:50:06 -05:00
rhymes
ffc96db209
Rubocop: fix additional violations in todo file (#9218) 2020-07-09 10:25:44 -04:00
Alex
bac350e877
[deploy] Add role and docs for user subscription liquid tag (#9170)
* Create new restriced_liquid_tag role

* Update role spec

* Use new role over admin

* Add documentation for user_subscription_liquid_tag

* Stub roles to help avoid flaky specs

* Add user approved liquid tags to edit view

* Remove "simply". Coding is hard, yo!

* Update liquid_help

* Update liquid help

* Update and refactor dashboard specs

* Refactor role check for liquid tag docs

* Improve docs wording
2020-07-08 14:07:53 -04:00
rhymes
5b62811c98
[deploy] Rubocop: fix violations of Layout/LineLength (#9197) 2020-07-08 08:36:36 -05:00
Alex
9f9236164c
[deploy] Add subscriptions to the dashboard (#9161)
* Add /dashboard/subscriptions route

* Dashboard controller updates

* Update ArticlePolicy with subscriptions?

* Update article row view in dashboard

* Add subscriptions view

* Add specs

* Add comment for pagination limit

* Use cached user_subscriptions count

* Add spec for cache counter

* Add path helper
2020-07-08 08:31:03 -04:00
rhymes
8afc9bb0c3
[deploy] Add unique indexes to follows - part 7 (#8215) 2020-07-06 11:15:56 -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
9ee024f9d0
UserSubscription backend refactor (#9060)
* Refactor controller validations to model

* Update specs and move current email validation back

* Refactor #subscribed

* Cleanup UserSubscriptions::Create service

* Refactor service

* Move source inside of call for clarity

* Specs for UserSubscription::Create

* Cleanup spec

* Fix Article spec

* Updated for subscriber_email

* Add comment for explicitness of subscriber_email

* Fix reference in comment...oops!

* I know what I'm doing...sometimes...maybe

* Rename CachChecker - Subscription to IsSubscribed

* Use include vs eq in specs for error messages

* attr_accessor --> attr_reader

* Don't explicitly set nil

* Rename Create service to CreateFromService

* Use errors_as_sentence

* Rename service to CreateFromControllerParams

* Assign Struct to a new constant
2020-07-02 12:08:37 -04:00
Jacob Herrington
83ba6b64c9
Stop allowing accented characters in tags (#9006)
* Stop allowing accented characters in tags

This commit will add strict frontend and backend validation for tags
disallowing accented characters.

* Update tags validation error message

* Add more character sets to tag validation spec
2020-07-01 11:48:25 +02: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
rhymes
2fff21f652
Add email panel to settings/account (#8727)
* Use crayons

* Add spec for Identity.email

* Refactor panels and ifs

* Update app/views/users/_account_providers_emails.html.erb

Co-authored-by: ludwiczakpawel <ludwiczakpawel@gmail.com>

* Update app/views/users/_account_providers_emails.html.erb

Co-authored-by: ludwiczakpawel <ludwiczakpawel@gmail.com>

* Update app/views/users/_account_providers_emails.html.erb

Co-authored-by: ludwiczakpawel <ludwiczakpawel@gmail.com>

Co-authored-by: ludwiczakpawel <ludwiczakpawel@gmail.com>
2020-06-18 13:08:46 +02:00
Julianna Tetreault
58f9c303aa
Add active_status_updated_at to the Broadcasts Table (#8451) [deploy]
* Add last_active_at datetime to Broadcasts table

* Add last_active_at to Broadcast index view

* Add callback to Broadcast.rb to update last_active_at

* Add a data_update script to backfill the last_active_at column on the Broadcasts table

* Add a spec for updating the last_active_at timestamp in models/broadcast_spec.rb

* Format last_active_at timestamp via strftime in index.html.erb

* Remove data_update_script: backfill_last_active_at_for_broadcasts

* Remove ActiveRecord::Dirty method from broadcast.rb

* Adjust callback in broadcast.rb and last_active_at timestamp format in index.html.erb

* Adjust time in #update_last_active_at and add the safe navigation operator to index.html.erb
  * Accounts for nil last_active_at values in the view
  * Uses Time.current in place of Time.zone.now

* Remove last_active_at param from Broadcasts::Controller

* Add spec to broadcasts_spec.rb to test the updated attribute via a request

* Adjust current_time in broadcasts_spec.rb

* Adjust Timecop.freeze in broadcasts_spec.rb to resolve Travis faliure (fingers crossed)

* Adjust expectation to compare against last_active_at timestamp rather than current time

* Adds Timecop back and stores last_active_at timestamp to test against

* Rename last_active_at to active_status_updated_at on Broadcasts table
  - Renames last_active_at to active_status_updated_at in specs
  - Renames last_active_at to active_status_updated_at in model
  - Renames last_active_at to active_status_updated_at in view
  - Adjusts spelling in spec descriptions
  - Rewords active_status_updated_at in view to Last Active On
2020-06-16 13:04:14 -06:00
rhymes
c753375daa
Routine rubocop fixes (#8685)
* rubocop -a

* rubocop --auto-gen-config

* Fix spec
2020-06-16 11:09:15 +02:00
rhymes
582d32393c
Small ActiveRecord optimizations: begone race conditions and hello bulk insert (#8436)
* Replace PollSkips find_or_create_by with create_or_find_by

* Use insert_all to add users to a channel in bulk

* Use bulk insert for DataUpdateScript and set private what shall be private

* oops
2020-06-15 17:57:14 +02:00
rhymes
380adc30ed
[deploy] Remove user_counters table (#8445) 2020-06-15 11:46:02 -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
rhymes
c356983de8
Replace activerecord-import with Rails 6 insert_all and upsert_all (#8407)
* Replace Credits.import with .insert_all

* Fix Notifications::Reactions::Send and replace .import with .upsert to avoid race conditions

* Replace .import! with .upsert_all in Notifications::NotifiableAction::Send

* Replace PodcastEpisode.import! with upsert

* Stop testing gems, test the code

* Remove activerecord-import

* Fix redundancies

* clarify comment

* Replace Credit.import with insert_all

* hello knapsack

* Do not try to insert if there is nothing to
2020-06-12 11:16:06 +02:00
Josh Puetz
d33322f8e4
Add json template to Pages (#8357)
* Add json template to pages

* Add jsonb field, tweak form
2020-06-10 09:42:15 -05:00
Vaidehi Joshi
defab11a4d
Provide default crayon styles when creating banners (#8361) [deploy]
* Provide default crayon styles when creating banners

* Import crayons styles into /internal pages.
* Allow admins to use crayons banner styles when creating broadcasts.
* Preview banner styles with crayons.

* Use constant and helper for broadcast banner styles

* Add VALID_BANNER_STYLES frozen constant to Broadcast class.
* Add banner_style helper for determining banner style class.
2020-06-09 11:26:14 -07:00
rhymes
71d53873d1
Use Rails 6 new features in the code (#8342)
* Use pick instead of pluck first

* Use touch_all instead of update_all

* Use destroy_by instead of where.destroy_all

* Use scopes

* Fix db:seed:replant

* Remove ActiveSupport::Cache::RedisCacheStore expires_in cache
2020-06-08 16:06:29 -04:00
Molly Struve
dd1cfd33e0
Remove video_permissions Role Reference From Specs and Code (#8344) 2020-06-08 10:23:53 -05:00
Molly Struve
c40f787aaa
[deploy] Make Video Permission a Valid Role (#8333) 2020-06-08 09:05:26 -05:00
Molly Struve
5d22e71ad6
nothing to see here....except maybe reverting a push to master (#8308)
🙈
2020-06-05 20:34:21 -05:00
mstruve
533cab50d6 synchronous roles 2020-06-05 20:02:41 -05:00
Alex
f7430ccd16
[deploy] Add path_redirects table and internal view (#8161)
* Create migrations

* Create PageRedirect model

* Refactor migration and add timestamps

* Add routes for internal/page_redirects

* Add index controller action and view

* Change background color of version in /internal

* Add page_redirect factory and index specs

* Fix specs

* Use ransack for search

* Alphabetize internal sidenav

* Rename spec

* Add edit view with destroy button

* Refactor page_redirect form partial

* Update error messages and fix redirect

* Small fixes and hookup new and create

* Specs FTW

* Fix migration, overridden --> source

* Add PageRedirect model specs

- Validate presence of status

* Update routes

* Code climate fixes

* Add old_slug_url and new_slug_url helper methods

* Prevent updating old_slug, refactor _form

* Add URLs to index view for slugs

* Better spec wording

* Change version to badges and add to edit view

* Update destroy response

* slug --> path 🙈

* Add PageRedirects to seed file

* Fix seed file

* ACTUALLY fix the seed file

* slug --> path in PageRedirect factory

* Remove bug fix from seeds file

* Move menu items to controller constant

* Update source type validation in model spec

* Rename page_redirect --> path_redirect

* Add AuditLog for admin create, destroy, and update

* Remove redundant index

* Cleanup old name of page_redirect

* Remove old model

* Update AuditLog to :internal

* Titleize search placeholder task in internal

* Add comment to explain MENU_ITEMS constant

* Add warning text on edit page about many updates

* Remove default and allow null on source

* Fix comment

* Add path_redirect validations and model specs

- Validate old_path != new_path
- Validate new_path isn't an existing redirect
2020-06-05 10:28:33 -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
Julianna Tetreault
7af4ee034f
Enforce Uniqueness for Broadcast Titles (#8239) [deploy]
* Add uniqueness validation to broadcast titles in broadcast.rb

* WIP: properly test title uniqueness in broadcast_spec.rb

* Add unique index for title and type_of on Broadcasts
  * Adds a unique index to the Broadcasts table
  * Adds broadcast.rb to .rubocop_todo.yml

* Resolve merge conflicts

* Add spec around duplicate broadcasts in broadcasts_spec.rb

* Adjust broadcast to be inactive in broadcasts_spec.rb
2020-06-02 15:43:59 -06:00