Commit graph

23 commits

Author SHA1 Message Date
rhymes
8b4a909aac
Rubocop fixes (#14868) 2021-09-30 13:22:09 -04:00
Molly Struve
e87dead7ad
Use new UserSetting and UserNotificationSettings and Ignore Related User Table Fields (#14121)
* schema file undelete description

* feat: v1 of the script

* Flesh out remaining enums under their categories

* complete UsersSettings data update script

* complete DUS for relevant attributes in users and profiles tables

* complete DUS for users_notification_settings

* alphabetize user_settings sql file

* safeguard against null values for "null: false" settings

* Set up actual UsersSettings DUS and specs files

* fix broken DUS script

* complete specs for UsersSetting DUS

* Address QA of specs

* complete specs for users_notification_settings DUS

* fix the typos (thanks Julianna!)

* begin implementation

* still building

* add missing attribute "email_membership_newsletter"

* complete sync code (except race condition for user profile)

* complete implementation, remains tests

* Address PR review and fix Travis fails

* remove superfluous Profile.new

* fix travis fails

* feat: update the users_notification_setting attributes from the user model

* feat: use the config fonts enums to display the fonts

* feat: loop through the keys

* fix profile = nil blowing up; add specs for notification_setting model

* remove unneeded spec

* remove feed validation until after sync code removed; fixes feed_import spec failures

* remove spec associated with feed_url validation in user_setting model

* fix failing spec 😅

* add TODO

* feat: set the user settings in the user controller  and use it in the customization form

* feat: move some update logic to the users settings controller thats being used from customization

* feat: show the updated values form the users_settingd and not the user instance

* Generalize redirect back to current tab

* still trying to reflect changed theme upon refresh

* customizations take effect on refresh

* remove 'with_feed' scope from user model

Co-authored-by: Jamie Gaskins <jamie@forem.com>

* start with takeover for fields previously in profiles table

* Takeover code for `publishing_from_rss` section in Settings (#13914)

* implement takeover code part 1

* implement takeover code

* fix feed fetch

* need rhymes help

* complete implementation; specs pending

* fix STUPID omission that caused so many headaches 😫

* implement profile fields pointing to users_settings 🎉

* run migrations

* implement inbox type & guidelines takeover code; specs pending (#13911)

* Point changes in notification settings to `users_notification_settings` table (#13910)

* implement takeover code; remains specs

* address PR feedback; remove related sync code

* address PR review feedback

* need help with routing and specs

* address pr review

* addressing pr review

* Treat implementation edge cases and omissions 😅

* fix uncommented comment

* fixing implementation cases

* address more PR review feedback

* fixing notifications use-cases

* refactor settings controller

* more pr review changes

* solving bugs

* fix broken onboarding

* handle eperience_level calls

* more fixes

* remove unneeded mappings

* add To-dos for quety updates

* remove done TODO

* purge done TODOs

* update notification_settings-related queries

* start fixing specs

* fixing specs

* fix notification and lrg_forem specs

* fixing broken specs

* still fixing

* fix line dif and remove reloads from user.rb

* run specs

* silence bullet and other fixes

* remove setting migration scripts and specs, fix more settings for specs

* handle missing user for article builder and fix notification specs

* fix some final controller specs and re-add incorrectly removed specs

* remove deprecated data update scripts and related workers, put travis back

* refactor admin tags mods controller, write/move specs for users notifications settings controller

* schema cleanup and other small refactors for consistency

* set field we can invalidate in spec via active record instead of at the db level

* remove I think an uneccessary hook call from subscribe_to_mailchimp_newsletter

* use bnefore_create to setup settings, please dont blow up the test suite

* mailchimp bot fix

* remove decorator in favor of single model method

Co-authored-by: Arit Amana <msarit@gmail.com>
Co-authored-by: Ridhwana <ridhwana.khan16@gmail.com>
Co-authored-by: Arit Amana <32520970+msarit@users.noreply.github.com>
Co-authored-by: Jamie Gaskins <jamie@forem.com>
2021-07-08 09:31:34 -05:00
Molly Struve
e07c707ede
[deploy] Refactor:Move remove_old_notifications Rake Task to Sidekiq (#9936)
* Refactor:Move remove_old_notifications Rake Task to Sidekiq

* fix typo
2020-08-24 08:48:46 -04: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
Vaidehi Joshi
a3d12e03a3
Add set_up_profile notification, check for active broadcasts (#7054) [deploy]
* Replace current onboarding notification with set_up_profile welcome notification

Also ensure that only "active" set_up_profile welcome notification is sent, and that "inactive" ones are ignored.

* Notify only if broadcast active, log error if broadcast not found

* Reports to Honeybadger if an active broadcast cannot be found

* Reorganize order of generator specs

* Ensure welcome_broadcast can be written to in spec

* Remove redundant spec
2020-04-02 15:56:29 -07:00
Mac Siri
2c5e12268f
Implement authentication welcome notification (#6846) 2020-03-27 15:21:40 -04:00
rhymes
118762ca9b
Some RSpec fixes (#6757)
* Fix spec/uploaders/profile_image_uploader_spec.rb

* Additional ordering based fixes

* Fix spec/requests/comments_spec.rb

* Fix spec
2020-03-24 13:16:19 -04:00
Julianna Tetreault
e8183189a7
Add welcome thread welcome notification (#6221) [deploy]
* Add Welcome Thread Broadcast to generator.rb

* Add welcome trait to broadcasts.rb

* Add additional tests around welcome_broadcasts:
- ensure that the correct Broadcast is sent
- ensure that a User only receives a single Notification
- ensure that only certain Users receieve the Notification

* Refactor and remove unncessary code from generator.rb and generator_spec.rb

* Refactor generator_spec and eagerly load welcome_thread_comment to get spec passing

* Initialize user in place of receiver_id in generator.rb

* Add before action to make generator_spec more readable

* Add latest_published_thread method to generator.rb

  * Update generator.rb to be reusable with latest_published_thread
  * Update generator_spec to use welcome tags for Article obj
  * Create mascot_account using let to reduce User creation in spec

* Adjust expectation for a User who should not receive a notification
2020-03-19 18:57:32 +01:00
Vaidehi Joshi
3bc0f49861
Only send notifications that belong to an active broadcast (#6319) [deploy]
* Use active in place of sent on internal broadcast routes

* Add and use active scope on broadcasts

* Update seeds + specs to use active broadcasts

* Add note about active broadcasts to /internal/broadcasts page
2020-02-27 08:02:45 -08:00
rhymes
4bf323bc83
Skip moderation notification if the user is the moderator (#6200)
* Skip moderation notification if the user is the moderator

* Update spec/workers/notifications/moderation_notification_worker_spec.rb

Co-Authored-By: Vaidehi Joshi <vaidehi.sj@gmail.com>

Co-authored-by: Vaidehi Joshi <vaidehi.sj@gmail.com>
2020-02-20 14:09:43 -05:00
Vaidehi Joshi
f71c8b16e7
Allow dynamic authoring of welcome notifications (#6045) [deploy]
* Add "Welcome" type to Broadcasts, allow dynamic "authoring" of Broadcasts

This adds a new `type_of` to the Broadcast model: "Welcome". As we begin to create a new "welcome notification" workflow, we'll categorize them by making them all of the same type.

This also adds a concept of a "welcoming user", which can be set via an ENV var. The WELCOMING_USER_ID will allow us to explicitly set (and change) which user in the database is the one that "sends" welcoming notification. In production, we plan for this to be dev.to/sloan.

* Allow WelcomeNotificationWorker to accept + send any kind of broadcast

This abstracts out the logic of deciding which broadcast to send from the woker into the calling method. This will help us send many different kinds of welcome notifications using one, resuable worker class.

* Raise if a Notification can't be created

* Add STAFF_USER_ID as an ENV var

This is in preparation for moving away from SiteConfig.staff_user_id, and replacing it with an ENV var. We will need to set this in production first, and then make a separate PR to replace all instances of staff_user_id with the newly-set ENV var.
2020-02-12 13:50:37 -08:00
Alex
6a100415cc
Move Notifications::TagAdjustmentNotificationJob to Sidekiq (#5909) [deploy]
* Create TagAdjustmentNotificationWorker

* Create TagAdjustmentNotificationWorker spec

* Update references and specs for new worker

* Future proof specs
2020-02-05 09:52:21 -08:00
Lucas Hiago
d5a5c53419 Change Notifications::UpdateJob to Notifications::UpdateWorker and move to sidekiq (#5689) [deploy] 2020-01-28 12:43:50 -05:00
Lucas Hiago
587d1040dc Change ModerationNotificationJob to ModerationNotificationWorker and move to sidekiq (#5683) [deploy] 2020-01-28 08:42:26 -05:00
serena
1297f1cb3e Replace Notifications::NotifiableActionJob with Notifications::NotifiableActionWorker for Sidekiq (#5588) [deploy] 2020-01-22 09:40:55 -05:00
Alex
e1e075479b Create new NewFollowerWorker and start sending jobs to it (#5556) [deploy] 2020-01-17 15:08:50 -05:00
Lucas Hiago
97aac4ef9b Change Notifications::MilestoneJob to Notifications::MilestoneWorker and move to sidekiq (#5454) [deploy] 2020-01-15 13:21:56 -05:00
Lucas Hiago
74f9decc56 Change Notifications::RemoveAllJob to Notifications::RemoveAllWorker and move to sidekiq (#5451) 2020-01-15 12:34:12 -05:00
Anna Buianova
05884acd19 Fixed rubocop issues (#5506) 2020-01-14 09:45:26 -06:00
serena
6e9539415e Move welcome notification job to worker for Sidekiq (#5465) [deploy] 2020-01-13 13:28:23 -06:00
Mukesh Chaudhary
48edaab5bc Migrate new reaction job 5305 (#5401)
* Add New Reaction Worker

* Add Specs for the New Reaction Worker

* Update Worker Calls in Notification Model

* Update Notification Model Specs

* Fix Code Climate Issues

* Fix notification specs to remove instance variable and complex logic

* Fix Worker Spec

* Fix Review Comments

* Undo Job Specs

Co-authored-by: Mukesh Chaudhary <45253983+mukeshchdy@users.noreply.github.com>
2020-01-09 09:51:56 -05:00
serena
252027ad9c use new_badge_achievement_worker instead of active job (#5358) [deploy] 2020-01-07 08:16:17 -05:00
serena
51df32552c Change MentionJob to MentionWorker and move to sidekiq (#5312) [deploy] 2020-01-02 07:57:08 -05:00