-
Notifications
You must be signed in to change notification settings - Fork 0
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
Feature/JA-80 UiMessagesService #66
Conversation
…ilure notifications
looks good, I'll approve this once we're done with services |
Except ValidationScriptsPartial
Also added missing calls to show messages and fixed minor issues found in code.
From notificationType to messageType.
Test - Ads_WhenResponseIsUnsuccessful_ShouldShowFailureMessage
Tests: - ShowMessage_WhenHttpContextIsNull_ShouldNotThrowException - ShowMessage_WhenMessageIsNull_ShouldReplaceItWithEmptyString - ShowMessage_WhenMessageTypeIsNull_ShouldReplaceItWithEmptyString - ShowMessage_WhenCalled_ShouldCorrectlyAddMessageToTempData - ShowSuccessMessage_WhenCalled_ShouldAddMessageWithCorrectType - ShowFailureMessage_WhenCalled_ShouldAddMessageWithCorrectType
I changed name of the service to I added some missing messages to be shown, but I didn't touch our Admin Panel controllers. I added tests for the service and 1 for |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks clean.
I know it's not what we're supposed to be focusing or right now, but I was a little inspired to make a centralized way of showing notifications.
I reduced out notifications to 2 types - Success and Failure. Message text is still added via TempData, but not directly.
To use this system, you inject
INotificationService
and callShowSuccessNotification(string message)
orShowFailureNotification(string message)
on it.I also added a static class with
public const string
fields with names of partials and notification types, so if we want to add a new partial, I suggest we add its name to thePartialNames
class and use it in Razor like this:<partial name="@PartialNames.MyPartial">
. This way we reduce the number of hardcoded strings and keep them in a single location.