Skip to content
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

[PM-10564] Push notification updates to other clients #5057

Open
wants to merge 9 commits into
base: km/pm-10600-full-notification-content
Choose a base branch
from

Conversation

mzieniukbw
Copy link
Contributor

@mzieniukbw mzieniukbw commented Nov 21, 2024

🎟️ Tracking

https://bitwarden.atlassian.net/browse/PM-10564

This is Part 3.
See Part 2: #5086
See Part 4: #5079

📔 Objective

When a notification is updated, marked as read or deleted, a push notification is sent with updated push type event. The push notification includes the ReadDate and DeletedDate fields.

Notes

  • Renamed SyncNotification to SyncNotificationCreate push type event.
  • Added SyncNotificationUpdate push type event
  • Enabled nullable checks in places in which i have added nullable field
  • Creation of notification status sends update push type event. This is because notification status does not serve any purpose without notification itself, they always are come together as pair. This means that the create or update on the status itself is always treated as update to the notification.

📸 Screenshots

⏰ Reminders before review

  • Contributor guidelines followed
  • All formatters and local linters executed and passed
  • Written new unit and / or integration tests where applicable
  • Protected functional changes with optionality (feature flags)
  • Used internationalization (i18n) for all UI strings
  • CI builds passed
  • Communicated to DevOps any deployment requirements
  • Updated any necessary documentation (Confluence, contributing docs) or informed the documentation team

🦮 Reviewer guidelines

  • 👍 (:+1:) or similar for great changes
  • 📝 (:memo:) or ℹ️ (:information_source:) for notes or general info
  • ❓ (:question:) for questions
  • 🤔 (:thinking:) or 💭 (:thought_balloon:) for more open inquiry that's not quite a confirmed issue and could potentially benefit from discussion
  • 🎨 (:art:) for suggestions / improvements
  • ❌ (:x:) or ⚠️ (:warning:) for more significant problems or concerns needing attention
  • 🌱 (:seedling:) or ♻️ (:recycle:) for future improvements or indications of technical debt
  • ⛏ (:pick:) for minor or nitpick changes

When a notification is updated, marked as read or deleted, a push notification is sent with updated push type event. The push notification includes the ReadDate and DeletedDate fields.
@mzieniukbw mzieniukbw changed the base branch from main to km/pm-10600 November 21, 2024 22:11
Copy link

codecov bot commented Nov 21, 2024

Codecov Report

Attention: Patch coverage is 59.39850% with 54 lines in your changes missing coverage. Please review.

Project coverage is 43.63%. Comparing base (9a06ab7) to head (1c9339b).

Files with missing lines Patch % Lines
...es/Implementations/RelayPushNotificationService.cs 0.00% 28 Missing ⚠️
...tations/NotificationsApiPushNotificationService.cs 0.00% 19 Missing ⚠️
...ementations/MultiServicePushNotificationService.cs 58.33% 3 Missing and 2 partials ⚠️
src/Core/Models/PushNotification.cs 80.00% 1 Missing ⚠️
...NoopImplementations/NoopPushNotificationService.cs 0.00% 1 Missing ⚠️
Additional details and impacted files
@@                            Coverage Diff                            @@
##           km/pm-10600-full-notification-content    #5057      +/-   ##
=========================================================================
+ Coverage                                  43.60%   43.63%   +0.02%     
=========================================================================
  Files                                       1456     1456              
  Lines                                      66610    66723     +113     
  Branches                                    6094     6098       +4     
=========================================================================
+ Hits                                       29047    29112      +65     
- Misses                                     36268    36316      +48     
  Partials                                    1295     1295              

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

…nt type.

Any update to the Notification from user perspective should be treated as update. That includes NotificationStatus, which when created would be displayed as update to the notification. Hence, push notification should be update type.
@mzieniukbw mzieniukbw requested review from a team, MGibson1 and withinfocus November 21, 2024 22:45
@mzieniukbw mzieniukbw marked this pull request as ready for review November 21, 2024 22:45
Copy link
Contributor

github-actions bot commented Nov 21, 2024

Logo
Checkmarx One – Scan Summary & Details070f4601-5902-4180-8ac0-fb6ac5d97366

No New Or Fixed Issues Found

Copy link
Contributor

@Thomas-Avery Thomas-Avery left a comment

Choose a reason for hiding this comment

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

Code changes look good.

I have one question around what should happen with individual notification status on a notification update. Should the notification statuses reset since the message is altered, or should they stay the same?

@mzieniukbw mzieniukbw marked this pull request as draft November 25, 2024 20:20
@mzieniukbw
Copy link
Contributor Author

Moving to draft for now. I will update the event types to be SyncNotification for the Create/Update cases of the Notification itself and 2nd event type for Status updates of SyncNotificationStatus.

…ates

Sync notification push type is now used for both Notification create and update.
Renamed the event types to specifically mention the purpose of status for notification status updates.
@mzieniukbw mzieniukbw marked this pull request as ready for review November 25, 2024 20:46
Copy link
Contributor

@Thomas-Avery Thomas-Avery left a comment

Choose a reason for hiding this comment

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

LGTM

@@ -25,7 +25,7 @@ public class AzureQueuePushNotificationServiceTests
[BitAutoData]
[NotificationCustomize]
[CurrentContextCustomize]
public async void PushSyncNotificationAsync_Notification_Sent(
public async Task PushSyncNotificationAsync_Notification_Sent(
Copy link
Contributor

Choose a reason for hiding this comment

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

👍 Nice job on updating these.

# Conflicts:
#	src/Core/Models/PushNotification.cs
#	src/Core/Services/IPushNotificationService.cs
#	src/Core/Services/NoopImplementations/NoopPushNotificationService.cs
#	test/Core.Test/NotificationCenter/Commands/CreateNotificationCommandTest.cs
#	test/Core.Test/NotificationHub/NotificationHubPushNotificationServiceTests.cs
#	test/Core.Test/Services/AzureQueuePushNotificationServiceTests.cs
@mzieniukbw mzieniukbw changed the base branch from km/pm-10600 to km/pm-10600-full-notification-content November 26, 2024 16:18
# Conflicts:
#	src/Core/Enums/PushType.cs
#	src/Core/NotificationHub/NotificationHubPushNotificationService.cs
#	src/Core/Services/IPushNotificationService.cs
#	src/Core/Services/Implementations/MultiServicePushNotificationService.cs
#	src/Core/Services/Implementations/NotificationsApiPushNotificationService.cs
#	src/Core/Services/Implementations/RelayPushNotificationService.cs
#	src/Core/Services/NoopImplementations/NoopPushNotificationService.cs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants