Commit graph

366 commits

Author SHA1 Message Date
Michael Kohl
1f66056f28
[deploy] Stop using ProfileField#active Part 2 (#9911)
* Remove ProfileField#active

* Add schema.rb
2020-08-24 13:13:51 +07:00
Emma Goto
34e5b68182
[deploy] Add ability to turn off reaction notifications in notification settings (#9435)
* Add ability to turn off reaction notifications in notification settings

* Rename article_reaction_notifications to react-Notifications

* Rename platform notification settings to general notification settings and add reactions toggle

* Fix new_reaction_worker_spec

Co-authored-by: rhymes <rhymes@hey.com>
Co-authored-by: Molly Struve <mollylbs@gmail.com>
2020-08-23 16:54:36 +02:00
Michael Kohl
b318b0a139
Add display columns to ProfileField (#9886)
Co-authored-by: rhymes <rhymes@hey.com>
2020-08-21 10:25:54 +07:00
rhymes
24b65c0c27
[deploy] Add relations and foreign keys between Podcast related models (#9888)
* Add proper relations and dependent clauses

* Add foreign key between podcast_episodes and podcasts
2020-08-20 16:53:53 +02:00
rhymes
99615705ca
[deploy] Add relations and foreign keys between Poll related models (#9854) 2020-08-20 11:14:54 +02:00
Raphael Noriode
30b3592488
[deploy] Listing endorsements: models setup (#9841)
* create listing endorsement model and write test to validate it

* create the classified_listing_endorsements table

* create model associations with seed data and test validations

* modify test and create more seed date for endorsement

* modify the model naming, changed seed data to become radomized and updated the test file

* remove unnecessary function
2020-08-20 11:13:44 +02:00
Michael Kohl
eff28766fc
[deploy] Migrate profile data (#9750)
* Add temporary Rake task for creating profile fields

* Fix problems after splitting branch

* Add profile migration Rake task

* Add unique index to profiles

* Add migration code to users

* Be smarter about updating profiles

* Update spec

* Update Bullet config

* Fix typo

* Change temporary rake task to data update script

* Re-add profile factory and update spec

* Change private declaration to make CodeClimate happy

* Update comment

* Drop validation in favor of DB default

* Update spec
2020-08-20 11:17:57 +07:00
Ben Halpern
6c71369df5
[deploy] Add community_name to site config (#9864)
* Add community_name to site config

* Fix a spec

* Remove SiteConfig from constants

* Change subjects to method

* Fix subjects method

* Fix linting
2020-08-19 14:54:40 -04: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
7c82487842
[deploy] Add missing foreign keys to DisplayAdEvent (#9786) 2020-08-17 16:46:40 +02:00
Michael Kohl
2b3242087c
[deploy] Start using profile model (#9724)
* Persist attribute_name for profile fields

* Update fields

* Add temporary Rake task for creating profile fields

* Update specs

* Fix problems after splitting branch
2020-08-17 09:57:50 +07:00
Molly Struve
b9d7202ec0
[deploy] Optimization:Migrate Final Small Table PKs to Bigints (#9706) 2020-08-11 15:51:54 -05:00
rhymes
d337f5ee41
[deploy] Add foreign keys to Ahoy models (#9636)
* Add foreign keys to Ahoy models

* Empty incorrect script

* Delete with SQL

* Moved cleanup script in #9710

* Trigger Travis correctly
2020-08-11 20:46:17 +02:00
Michael Kohl
2555de8a5f
Add profile model (#9648)
* Create profiles table

* Add store_attribute gem

* Add profile model

* Add default value to data column

* Add and update factories

* Add cascading delete

* Make field non-nullable

* Add specs

* Fix cascading delete for profiles
2020-08-11 10:15:22 +07:00
Molly Struve
b3d7f76dd0
[deploy] Optimization: Change Large Table Primary Keys to Bigints (#9476) 2020-08-08 18:45:01 -05:00
Molly Struve
04fea52893
[deploy] Update Users, Follows, Identities, and Reaction Pks to Bigints (#9615) 2020-08-06 18:27:08 -05:00
Michael Kohl
c2d23cfc4d
[deploy] Seed profile fields (#9605)
* Fix schema.rb

* Add service objects for base and link fields

* Add link fields to seeds

* Make placeholder a keyword argument

* Add work fields

* Add explanation column to profile fields

* Add coding fields

* Switch from inheritance to mixin

* Add email checkbox to base fields

* Add branding fields

* Add spec for ProfileFields::FieldDefinition

* Move migration back into correct location

* Rename column from explanation to description

* Rename attribute in mixin

* chore: rename from explanation to description

* Add ProfileFields::ImportFromCsv

* Simplify ProfileFields::ImportFromCsv

* Add comment about disabled cop to spec

* Add TODO comment to Rake task

* Document mixin

* Add groups to profile fields

Co-authored-by: Ridhwana <ridhwana.khan16@gmail.com>
2020-08-05 10:11:30 -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
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
Michael Kohl
1a6c6acd45
[deploy] Activate Devise::Lockable (#9535) 2020-07-30 10:28:51 -04: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
7460893159
[deploy] Optimization:Change Comment, Ad Events, and Github ID Code Ints to Bigints (#9543) 2020-07-28 14:35:03 -05:00
Molly Struve
97882ce31c
[deploy] Optimization:Change Tag Related IDs to Bigints (#9533) 2020-07-27 10:51:56 -05:00
Michael Kohl
f0c4197aab
Update seeds.rb with password confirmation (#9536) 2020-07-27 15:47:42 +02:00
Molly Struve
4f20555221
[deploy] Optimization:Change Multiple Small Table Column IDs to Bigints (#9513) 2020-07-26 16:16:13 -05:00
Molly Struve
21b1afb076
[deploy] Optimization:Change Mentions, Notes, Podcasts, Roles Related Ids To Bigints (#9477) 2020-07-25 16:11:26 -05:00
Molly Struve
06fb3cff6b
[deploy] Optimization:Recreate Comments Index with Digest Hash (#9474) 2020-07-25 14:32:00 -05:00
Molly Struve
b6cc3ebb9a
[deploy] Optimization:Change Podcast and Episode PKs to Bigints (#9423) 2020-07-22 09:15:10 -05:00
Molly Struve
d79a2133f7
[deploy] Optimization:Change Tweet Primary Key to Bigint (#9409) 2020-07-21 08:08:52 -05:00
Molly Struve
c99cd29eb2
[deploy] Optimization:Change Role PKs from Int to Bigint (#9403) 2020-07-20 12:26:55 -05:00
Molly Struve
d9beec9419
[deploy] Optimization:Change Primary Keys on Mentions and Notes to Bigint (#9393) 2020-07-20 09:04:18 -05:00
Molly Struve
914e8b80a8
[deploy] Optimization:Change Broadcast and GithubIssue PKs to Bigint (#9372) 2020-07-19 17:41:37 -05:00
Molly Struve
129b60772c
[deploy] Refactor:Drop Blocks Table (#9373) 2020-07-17 16:29:05 -05:00
rhymes
995f9f8679
Create Listings in seed file (#9351) 2020-07-16 12:08:11 -04: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
Julianna Tetreault
5f143c4308
Add Polymorphism to Broadcasts (Part 1) (#9231) [deploy]
* Add polymorphism to Broadcasts table
  - Adds a broadcastable_id column to Broadcasts
  - Adds a broadcastable_type column to Broadcasts

* Create Announcements and Welcome Notifications tables
  - Adds an Announcements table
  - Adds a Welcome Notifications table
  - Adds timestamps to both tables
  - Adds banner_style column to Announcements table

* Adds Announcement and Welcome Notification models
  - Adds an Announcement model in prep for polymorphism
  - Adds a WelcomeNotification model in prep for polymorphism

* Add data_update script to backfill type_of column for Broadcasts

* Add unique index on broadcastable_type and broadcastable_id on the Broadcasts table

* Add update! to the data_update script to backfill broadcastable_type
2020-07-13 09:36:19 -06: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
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
Vaidehi Joshi
904f0dac78
Add ahoy + welcome notification tracking (#8758) [deploy]
* Set up ahoy gem, add ahoy-js

* Import ahoy.js into base.js.erb

* Add trackNotification function to notifications/index.html.erb

* Add sanitized_broadcast_id helper

* Use sanitized_broadcast_id in broadcast partial

* Add specs around tracking welcome notifications

* Remove optional fields from Ahoy::Visit migration + table

* Fiddle with trait to see if it helps with CI failures

* Disable geocode tracking in ahoy

* Stub out SiteConfig in notifications page spec
2020-06-18 13:40:14 -07: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
Joe Doss
3ba1692eab
Don't seed in production when using db:prepare (#8754)
* We don't want to do devel seeding in production mode when using db:prepare. This
PR fixes that. We can also use seeds.rb to do production seeding for new Forems
in the future.

* Just return if in production instead of wrapping the entire file in an if statement.
2020-06-18 10:39:20 -04:00
Molly Struve
76a0a96495
[deploy] Optimization: Add Index to Article Public Reaction Counts for Sorting (#8716) 2020-06-16 18:00:25 -04: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
Molly Struve
e47037087d
[deploy] Optimization: Remove unused indexes from Postgres (#8693) 2020-06-16 11:13:38 -05: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
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