Skip to content

feat: notifications for new engagements (resolves #2562) #2604

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 19 commits into from
May 2, 2025

Conversation

jobara
Copy link
Collaborator

@jobara jobara commented Mar 19, 2025

Resolves #2562

  • Updates the notifcations settings page for Individuals
  • Updates the notifications settings page for Community Orgs
  • New Individuals will automatically have the notifications settings for new engagements enabled
  • New Community Orgs will automatically have the notifications settings for new engagements enabled
  • Updated Tests
  • Added YesNo Enum
  • Clean up to use UserContext enum
  • Notify all individuals (who have notification setting enabled) of new open-call engagements
  • Notify all Community Orgs (who have notifications setting enabled) of all new engagements from other Orgs
  • Adds tests for engagement notifications for Individuals
  • Adds tests for engagement notifications for Community Orgs
  • Adds console command for migrating data that can't be done in a DB migration.
  • Console command added to deploy scripts to be run on deployment

TODO:

After releasing and deploying to staging and production the following should be run to update users and orgs. It will replace the existing notification_settings with one where the engagement notifications are on by default. It will also remove all other notifications_settings that may have been set before as they are no longer supported.

Instead of the following methods for individual users and organizations, this console command can be run instead.

php artisan app:migrate-settings-data

Individual Users

User::where('context', 'individual')->get()->each(function ($user) {$user->notification_settings = ['engagements' => '1']; $user->save();});

Organizations

Organization::all()->each(function ($organization) {$organization->notification_settings = ['engagements' => '1']; $organization->save();});

Prerequisites

If this PR changes PHP code or dependencies:

  • I've run composer format and fixed any code formatting issues.
  • I've run composer analyze and addressed any static analysis issues.
  • I've run php artisan test and ensured that all tests pass.
  • I've run composer localize to update localization source files and committed any changes.

If this PR changes CSS or JavaScript code or dependencies:

  • I've run npm run lint and fixed any linting issues.
  • I've run npm run build and ensured that CSS and JavaScript assets can be compiled.

Copy link

codecov bot commented Mar 19, 2025

Codecov Report

Attention: Patch coverage is 93.75000% with 8 lines in your changes missing coverage. Please review.

Project coverage is 97.22%. Comparing base (a9591bc) to head (1a24e0b).
Report is 2 commits behind head on dev.

Files with missing lines Patch % Lines
app/Console/Commands/MigrateSettingsData.php 86.66% 8 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##                dev    #2604      +/-   ##
============================================
- Coverage     97.27%   97.22%   -0.06%     
- Complexity     2302     2326      +24     
============================================
  Files           349      353       +4     
  Lines         10511    10531      +20     
============================================
+ Hits          10225    10239      +14     
- Misses          286      292       +6     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@jobara jobara marked this pull request as ready for review March 25, 2025 01:05
@jobara jobara requested a review from greatislander March 25, 2025 01:16
@jobara jobara added this to the 1.7.0 milestone Mar 31, 2025
@jobara jobara moved this to In Progress in Public Launch Apr 3, 2025
Copy link
Collaborator

@greatislander greatislander left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me. I'm wondering if it might make sense to write a migration which would handle updating the notification settings as described in the PR description.

@jobara
Copy link
Collaborator Author

jobara commented Apr 22, 2025

This looks good to me. I'm wondering if it might make sense to write a migration which would handle updating the notification settings as described in the PR description.

@greatislander and I discussed this. The new idea is to create a generic settings migration console command. This would run the data migration as mentioned the description above, it would also provide documentation for the change including the issue and PR it's related to.

@jobara
Copy link
Collaborator Author

jobara commented May 1, 2025

@greatislander I've pushed up the changes to add a console command for the migration step. However, I still need to add tests for it. I'm also running into some larastan complaints related to the console command, but all the cases where it is complaining are valid. Not sure what the appropriate work around or declaration is for those.

@jobara jobara requested a review from greatislander May 1, 2025 18:05
@jobara
Copy link
Collaborator Author

jobara commented May 1, 2025

@greatislander this is ready for review. I've added new tests for the console command (had to change the output for list to get the tests to work), add some docs to the readme, added the console command to be run on deploy.

@greatislander greatislander merged commit 63f5233 into accessibility-exchange:dev May 2, 2025
6 of 8 checks passed
@github-project-automation github-project-automation bot moved this from In Progress to Done in Public Launch May 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Send a notification to all consultation participants when a new engagement is added.
2 participants