Skip to content

PSP-11251 Notifications popover#5339

Open
asanchezr wants to merge 28 commits into
bcgov:notificationsfrom
asanchezr:psp-11251-notifications-popover
Open

PSP-11251 Notifications popover#5339
asanchezr wants to merge 28 commits into
bcgov:notificationsfrom
asanchezr:psp-11251-notifications-popover

Conversation

@asanchezr

@asanchezr asanchezr commented Jun 22, 2026

Copy link
Copy Markdown
Collaborator

Empty state

image

< 10 notifications

notification-popover

Notification menu

image

Load more when >= 10 notifications active

notifications-load-more

Scrollbar state

notification-popover-scroll-bar

@asanchezr asanchezr self-assigned this Jun 22, 2026
@asanchezr asanchezr added the enhancement New feature or request label Jun 22, 2026
@mergify

mergify Bot commented Jun 22, 2026

Copy link
Copy Markdown

Tick the box to add this pull request to the merge queue (same as @mergifyio queue).

  • Queue this pull request

@asanchezr asanchezr requested a review from eddherrera June 22, 2026 23:33
@asanchezr

Copy link
Copy Markdown
Collaborator Author

To facilitate testing:

Fist, open a few leases from the Lease List view and add a reminder for the Lease Renewal expiry date. If the lease has no renewal, you will have to edit the lease and add a renewal with an expiry date first.

Once you have lease renewals in place, you can add reminders for it. Make sure to make the reminders in the past (ie, yesterday or older) - I'll explain in a moment why

Then, after setting reminders for a few leases (e.g. 5 or more), run the following SQL to "trigger" the notifications for those reminders. The SQL will look at the reminders with trigger date less than today and will set the "SENT_DATE" on the notification output table for the corresponding entry. This will allow the popover to show the notifications (basically this is what the scheduler does daily so the SQL is a shortcut for testing locally)

WITH cte AS (
SELECT TOP 100 OUTP.NOTIFICATION_SENT_DT, OUTP.CONCURRENCY_CONTROL_NUMBER FROM PIMS_NOTIFICATION_USER_OUTPUT OUTP JOIN 
	PIMS_NOTIFICATION_USER NUSR ON OUTP.NOTIFICATION_USER_ID = NUSR.NOTIFICATION_USER_ID JOIN
	PIMS_NOTIFICATION NOTI ON NUSR.NOTIFICATION_ID = NOTI.NOTIFICATION_ID
WHERE OUTP.NOTIFICATION_OUTPUT_TYPE_CODE = 'PIMS' 
	AND NOTI.NOTIFICATION_TRIGGER_DATE <= CONVERT (DATE, GETUTCDATE())
ORDER BY NOTI.NOTIFICATION_TRIGGER_DATE ASC
)

UPDATE cte 
SET CONCURRENCY_CONTROL_NUMBER = CONCURRENCY_CONTROL_NUMBER + 1,
NOTIFICATION_SENT_DT = CONVERT (DATE, GETUTCDATE())

@eddherrera

Copy link
Copy Markdown
Collaborator

Would like to see if there's any other conflict from the Hangfire PR. Please include and rebase your PR.

@asanchezr asanchezr force-pushed the psp-11251-notifications-popover branch from a20b5e6 to c5b1a77 Compare June 23, 2026 04:04
@asanchezr

Copy link
Copy Markdown
Collaborator Author

Would like to see if there's any other conflict from the Hangfire PR. Please include and rebase your PR.

PR rebased

[Produces("application/json")]
[SwaggerOperation(Tags = new[] { "user-notifications" })]
[ProducesResponseType(typeof(List<NotificationUserOutputModel>), 200)]
[ProducesResponseType(typeof(List<NotificationOutputModel>), 200)]

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

NIT: I found this naming ambiguous between [PIMS_NOTIFICATION_USER_OUTPUT and [PIMS_NOTIFICATION_OUTPUT_TYPE]

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I'd like to keep it as is for now. The type is not a model but an enum. The word user is actually confusing there. The notification "output" === "delivery" (at least in my mind). If after a while we are still confused we can rename those later

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

We can have a longer discussion on entity naming for notifications and create a tech debt ticket to address all renaming there


var items = baseQuery
.OrderByDescending(o => o.NotificationUser.Notification.NotificationTriggerDate)
.ThenByDescending(o => o.NotificationUserOutputId)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

do we need this second ordering? I notice that in your snapshots is not ordered by date. could this be the cause of it?

.ThenInclude(nu => nu.Notification)
.ThenInclude(n => n.NotificationTypeCodeNavigation);

if (deep)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

We could have just always return the "deep" wich is ok since none of these goes above the granchild level.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

The deep comes at a cost. This is 13 tables joined together. If you look at all the code paths, we don't need deep for the case of updating the "isRead/isUnread" (which lives in the main entity, not any of the associated joins).

For the case of either getting a list of "inbox items" or a single item, then yes the deep joins are needed

/// <summary>
/// Creates a new instance of a NotificationInboxRepository, and initializes it with the specified arguments.
/// </summary>
public NotificationInboxRepository(

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

nit: At repository level I would have rather name it closer to the Entity. 'NotificationUserOutputRepo..'

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Sure, but you already created one that was named like that NotificationUserOutputRepo which is why in your PR I commented that we need to differentiate the ADMIN surface area API from the USER based API. We can align on naming and rename all the repos/services/controllers next sprint

@sonarqubecloud

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants