Commit graph

7 commits

Author SHA1 Message Date
Mac Siri
842e6880b8
Routine rubocop fix on /spec (#19217)
* Softrun rubocop

* Hardrun rubocop (-A)

* Change a rubocop rule

* Add missing cops

* Undo & redo rubocop -A
2023-03-21 09:55:26 -04:00
rhymes
b6e0723031
Fix Rails/HasManyOrHasOneDependent for Broadcast and Collection (#9662) 2020-08-07 14:27:24 -04:00
rhymes
5b62811c98
[deploy] Rubocop: fix violations of Layout/LineLength (#9197) 2020-07-08 08:36:36 -05: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
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
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
Vaidehi Joshi
a4be185720
Leverage announcement broadcasts (#8150) [deploy]
* Differentiate between welcome + announcement broadcasts

* Allow admins to filter between these two types in the `/internal/broadcasts` UI.
* Ensure that the index endpoint fetches the correct Broadcast models.

* Only allow one Announcement broadcast to be created at a time

* Also add some `announcement` and `welcome` scopes on the `Broadcast` class.
* Add flash[:success] messages in BroadcastsController.

* Add some tests for Announcement broadcast validations

* Remove unused active_announcement_params method

* Order Broadcasts by title, optimization improvements

* Fix missing closing tags in broadcast specs
2020-05-29 11:38:41 -07:00