Skip to content

Conversation

@DanBloxham-sw
Copy link
Contributor

@DanBloxham-sw DanBloxham-sw commented Sep 1, 2021

JIRA link

https://softwiretech.atlassian.net/browse/HEEDLS-519

Description

Updated the SystemNotificationController so that the cookie set when first visiting the page (Show Later link no longer needs to be clicked, allowing the user to immediately return to the dashboard). Also deleted the cookie when no more unacknowledged notifications exist.

Screenshots

N/A


Developer checks

I have:

  • Run the formatter and made sure there are no IDE errors.
  • Written tests for the changes (controller, data services, services, view models etc) and manually tested my work with and without JavaScript. Full manual testing guidelines can be found here: https://softwiretech.atlassian.net/wiki/spaces/HEE/pages/6703648740/Testing
  • Updated/added documentation in Swiki and/or Readme.
  • Updated my Jira ticket with information about other parts of the system that were touched as part of the MR and have to be sanity tested to ensure nothing’s broken.
  • Scanned over my own MR to ensure everything is as expected.

Copy link
Contributor

@AlexJacksonDS AlexJacksonDS left a comment

Choose a reason for hiding this comment

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

I can't raise against the lines, but does this change not make the SkipNotifications action redundant?

@DanBloxham-sw
Copy link
Contributor Author

In a most cases, SkipNotifications is pretty redundant. But if there are unacknowledged notifications, skipping will reset the expiry date. It will also set the cookie if the user visits the page when no notifications are present, in case the user definitely doesn't want to see any new notifications in the next 24 hours. But these are so minor that we could get rid of them if we think its unnecessary.

@AlexJacksonDS
Copy link
Contributor

It's not doing anything that the else branch isn't doing, and I assume the only page linking to the Skip action is the notification page which will have literally just set it in the else. I think the behaviour you've just described would be unexpected. If a user has no notification and then gets some, I think they should be forced to view them the next time.

Copy link
Contributor

@stellake stellake left a comment

Choose a reason for hiding this comment

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

One minor improvement suggestion to avoid double "if" blocks, but no need for rereview :)

Comment on lines 37 to 47
if (unacknowledgedNotifications.Count == 0)
{
if (Request.Cookies.HasSkippedNotificationsCookie(adminId))
{
Response.Cookies.DeleteSkipSystemNotificationCookie();
}
}
else
{
Response.Cookies.SetSkipSystemNotificationCookie(adminId, clockService.UtcNow);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Could this be simplified with:

if (unacknowledgedNotifications.Count > 0) {
    Response.Cookies.SetSkipSystemNotificationCookie(adminId, clockService.UtcNow);
} else if (HasCookie) {
   Response.Cookies.DeleteSkipSystemNotificationCookie();
}

// continue

@DanBloxham-sw DanBloxham-sw merged commit a0cfb68 into master Sep 6, 2021
@DanBloxham-sw DanBloxham-sw deleted the HEEDLS-519-ChangeSystemNotificationCookieManagement branch September 6, 2021 15:19
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.

4 participants