docbrown/spec/models
Julianna Tetreault c87974b7ac
[deploy] Add co_author_ids to Articles (#10339)
* Replaces second_user_id and third_user_id with co_author_ids on the Articles table

* Adjusts migration that adds co_author_ids to also add array: true

* Replaces second_user_id and third_user_id with co_author_ids in all applicable files
  - Use co_author_ids in _individual_article view
  - Use co_author_ids in articles and stories controllers
  - Use co_author_ids in article and podcast_episode models
  - Use co_author_ids in article_dashboard
  - Use co_author_ids in comments_helper
  - Use co_author_ids in articles_spec

* Replaces second_user_id and third_user_id with co_author_ids in article.rb model

* Remove unused #assign_co_authors method from the Stories::Controller

* Add #co_authors and #co_author_name_and_path to article_decorator.rb

* Adds a descriptive form field for co_author_ids for Admins in /admin/articles

* Adds a conditional in article/show.html.erb to render co_author names on an Article in a human-readable way

* Replaces get_co_author_name_and_path with proper method name, co_author_name_and_path in show.html.erb

* Adds latest schema to (hopefully) resolve Travis conflicts

* Adds the safe operator to show.html.erb

* Adjusts articles_spec.rb to use an array in the first test

* Replaces unless &.empty? with if ./present? in articles/show.html.erb

* Replaces second_user_id with co_author_ids in stories_show_spec.rb test

* Replaces elsif with else in articles/show.html.erb

* Cleans up show.html.erb by removing conditional in favor of decorator method

* Refactors splitting of params in Articles::Controller and optimizes query in #co_authors

* Reverts removal of second_user_id and third_user_id and migration file

* Adds a data_update script to update co_author_ids with existing second and third user_ids

* Adds validations to co_authors and flash_messages to indicate whether an update was successful or not
  - Adds to methods to article.rb to validate the IDs of co_authors and authors
  - Adds flash messages to the Admin::Articles::Controller and a redirect to the show page
  - Removes the JS highlighting upon submit when updating an Article in Admin
  - Refactors #update action in Admin::Articles::Controller

* Adds tests to article_spec.rb around co_author_id validations in article.rb

* Adjusts #validate_co_authors_must_not_be_the_same to use .include? instead

* Uses Field::Select.with_options in article_dashboard.rb to properly display co_author_ids

* Reverts removal of assigning co_author_ids in the Stories::Controller

* Adjusts error message and adjusts return logic in article.rb (thanks, Fernando!)

* Fixes failing article_spec.rb test that checks for co_author_ids uniqueness

* Adds a default array to co_author_ids and checks if they are .blank?

* Refactor data_update script to use a single SQL statement (thank you, Michael)

* Preserve array order of co_author_ids in article_decorator.rb

* Add db file for default: []

* Add validation to fix bug related to text inputs and invalid users when adding co_authors

* Adds tests to ensure that co_author_ids are both an integer and an integer > 0

* Updates admin/articles_spec.rb to default [] instead of nil

* Adjusts validations in article.rb to be DRY-er and more consistent

* Consolidates validations further

* Refactors validations in article.rb to use procs

* Refactors data_update script to remove nil values from array
2020-10-02 11:06:11 -04:00
..
ahoy [deploy] Rubocop: fix Rails/HasManyOrHasOneDependent for Ahoy::Visit and Badge (#9565) 2020-07-31 11:43:50 -04:00
concerns Allow Nginx cached static content to be purged (#9857) [deploy] 2020-08-21 09:31:23 -07:00
shared_examples Add custom profile fields (#10202) 2020-09-09 14:37:15 +00:00
webhook Add missing presence validators to models (#10495) 2020-10-01 16:15:32 +02:00
api_secret_spec.rb Limit the Number of API Keys a User Can Have (#7870) 2020-05-15 11:33:02 +02:00
application_record_spec.rb Switch decorators to Rails builtin decorations - take 2 (#6125) [deploy] 2020-02-19 15:30:53 -05:00
article_destroy_spec.rb [deploy] Rubocop: fix violations of Layout/LineLength (#9197) 2020-07-08 08:36:36 -05:00
article_spec.rb [deploy] Add co_author_ids to Articles (#10339) 2020-10-02 11:06:11 -04:00
audit_log_spec.rb Add missing presence validators to models (#10495) 2020-10-01 16:15:32 +02:00
badge_achievement_spec.rb Flaky Spec Fix:Remove let_it_be Test Prof Helper (#9556) 2020-07-29 11:31:01 +02:00
badge_spec.rb Add missing presence validators to models (#10495) 2020-10-01 16:15:32 +02:00
banished_user_spec.rb Introduce BanishedUser table (#5589) [deploy] 2020-01-21 17:15:58 -05:00
broadcast_spec.rb Fix Rails/HasManyOrHasOneDependent for Broadcast and Collection (#9662) 2020-08-07 14:27:24 -04:00
buffer_update_spec.rb [deploy] Add missing FKs to BadgeAchievements BanishedUsers BufferUpdates (#10366) 2020-09-29 21:43:14 +02:00
chat_channel_membership_spec.rb Rubocop: move dot in multi-line calls to leading position (#9262) 2020-07-16 15:51:11 +02:00
chat_channel_spec.rb [deploy] Add missing FKs to FeedbackMessage, Note, Taggings, Tag, and UserRole (#10376) 2020-09-29 16:49:47 +02:00
collection_spec.rb Fix Rails/HasManyOrHasOneDependent for Broadcast and Collection (#9662) 2020-08-07 14:27:24 -04:00
comment_spec.rb Add missing presence validators to models (#10495) 2020-10-01 16:15:32 +02:00
credit_spec.rb Flaky Spec Fix:Remove let_it_be Test Prof Helper (#9556) 2020-07-29 11:31:01 +02:00
custom_profile_field_spec.rb Add custom profile fields (#10202) 2020-09-09 14:37:15 +00:00
data_update_script_spec.rb Add missing presence validators to models (#10495) 2020-10-01 16:15:32 +02:00
display_ad_event_spec.rb Flaky Spec Fix:Remove let_it_be Test Prof Helper (#9556) 2020-07-29 11:31:01 +02:00
display_ad_spec.rb [deploy] Remove orphaned DisplayAdEvent rows (#9765) 2020-08-14 09:29:08 -04:00
email_authorization_spec.rb Add missing presence validators to models (#10495) 2020-10-01 16:15:32 +02:00
email_message_spec.rb [deploy] Add missing foreign keys to ahoy_messages and articles (#10321) 2020-09-16 19:47:03 +02:00
event_spec.rb Move Events::BustCacheJob to Sidekiq and rename (#5379) 2020-01-06 15:51:46 -05:00
feedback_message_spec.rb [deploy] Add missing FKs to FeedbackMessage, Note, Taggings, Tag, and UserRole (#10376) 2020-09-29 16:49:47 +02:00
follow_spec.rb Add missing presence validators to models (#10495) 2020-10-01 16:15:32 +02:00
github_issue_spec.rb [deploy] Decouple GitHub authentication from fetching GitHub issues (#7660) 2020-05-04 16:17:16 -04:00
github_repo_spec.rb [deploy] Optimization:Break Github Repo Updates into Individual Sidekiq Jobs (#10040) 2020-08-27 16:01:36 -05:00
html_variant_spec.rb [deploy] Add relations and foreign keys between HtmlVariant related models (#9846) 2020-08-18 11:33:38 -04:00
html_variant_success_spec.rb Unskip all skipped specs (#2941) 2019-05-25 11:04:38 -04:00
html_variant_trial_spec.rb Unskip all skipped specs (#2941) 2019-05-25 11:04:38 -04:00
identity_spec.rb [deploy] Refactor:Remove BackupData Model and Code (#10409) 2020-09-22 16:45:18 -05:00
listing_category_spec.rb Rubocop: Fix ListingCategory has_many relation to Listing (#9853) 2020-08-19 19:23:49 +02:00
listing_endorsement_spec.rb [deploy] Listing endorsements: models setup (#9841) 2020-08-20 11:13:44 +02:00
listing_spec.rb [deploy] Listing endorsements: models setup (#9841) 2020-08-20 11:13:44 +02:00
mention_spec.rb Add Mentions::CreateAllWorker for Sidekiq (#5463) 2020-01-13 13:23:30 -06:00
message_spec.rb Optimization:Dont Notify of Channel Leavings (#10518) 2020-10-02 16:19:54 +02:00
note_spec.rb [deploy] Add missing dependent clauses to User and cleanup relations (#10011) 2020-08-28 20:19:24 +02:00
notification_spec.rb [deploy] Add missing foreign keys to models related to users (#10018) 2020-08-31 15:39:57 +02:00
notification_subscription_spec.rb Add missing presence validators to models (#10495) 2020-10-01 16:15:32 +02:00
organization_membership_spec.rb [deploy] Create private group chat channel for orgs (#7270) 2020-04-16 17:02:06 -04:00
organization_spec.rb Add missing presence validators to models (#10495) 2020-10-01 16:15:32 +02:00
page_spec.rb Add json template to Pages (#8357) 2020-06-10 09:42:15 -05:00
page_view_spec.rb Remove UserHistory Feature and PageViews from Algolia (#6127) [deploy] 2020-02-18 10:06:30 -05:00
podcast_episode_spec.rb Add missing presence validators to models (#10495) 2020-10-01 16:15:32 +02:00
podcast_spec.rb [deploy] Add relations and foreign keys between Podcast related models (#9888) 2020-08-20 16:53:53 +02:00
poll_option_spec.rb Add missing presence validators to models (#10495) 2020-10-01 16:15:32 +02:00
poll_skip_spec.rb Flaky Spec Fix:Remove let_it_be Test Prof Helper (#9556) 2020-07-29 11:31:01 +02:00
poll_spec.rb Add missing presence validators to models (#10495) 2020-10-01 16:15:32 +02:00
poll_vote_spec.rb Upgrade Rubocop related gems and fix new violations (#3581) [ci skip] 2019-07-30 14:29:05 -04:00
profile_field_group_spec.rb Routine rubocop fixes (#10237) 2020-09-08 12:06:47 -04:00
profile_field_spec.rb Add missing presence validators to models (#10495) 2020-10-01 16:15:32 +02:00
profile_pin_spec.rb Flaky Spec Fix:Remove let_it_be Test Prof Helper (#9556) 2020-07-29 11:31:01 +02:00
profile_spec.rb Add missing presence validators to models (#10495) 2020-10-01 16:15:32 +02:00
rating_vote_spec.rb [deploy] Add missing foreign keys to models related to users (#10018) 2020-08-31 15:39:57 +02:00
reaction_spec.rb [deploy] Refactor:Remove Reaction Search Code (#10377) 2020-09-23 12:27:50 -05:00
response_template_spec.rb [deploy] Rubocop: fix violations of Layout/LineLength (#9197) 2020-07-08 08:36:36 -05:00
role_spec.rb [deploy] Add new support admin role (#9681) 2020-08-07 22:52:13 -04:00
site_config_spec.rb Add missing presence validators to models (#10495) 2020-10-01 16:15:32 +02:00
sponsorship_spec.rb Add missing presence validators to models (#10495) 2020-10-01 16:15:32 +02:00
tag_adjustment_spec.rb [deploy] Rubocop: fix violations of Layout/LineLength (#9197) 2020-07-08 08:36:36 -05:00
tag_spec.rb Add missing presence validators to models (#10495) 2020-10-01 16:15:32 +02:00
tweet_spec.rb [deploy] Rubocop: fix violations of Layout/LineLength (#9197) 2020-07-08 08:36:36 -05:00
user_block_spec.rb Improve speed of model tests by around 50/60 seconds (#5016) 2019-12-09 16:33:48 -05:00
user_spec.rb Add missing presence validators to models (#10495) 2020-10-01 16:15:32 +02:00
user_subscription_spec.rb [deploy] Set UserSubscription sourceable columns to nullable (#10033) 2020-08-27 16:25:48 +02:00