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

Fix Notification suppression logic #3218

Closed
wants to merge 3 commits into from

Conversation

Ashesh3
Copy link
Member

@Ashesh3 Ashesh3 commented Jul 24, 2022

There are minor issues in the way fireRequest decides when to suppress error notifications.
It was recently changed in da40a71

  1. suppressNotif? : true,
    This defines an optional parameter suppressNotif which has a type of true | undefined. This is not the intended behavior. It should rather be a parameter named suppressNotif of type Boolean which defaults to false. false because the old behavior of the CARE platform was not to suppress these errors unless explicitly specified. It seems that the below logic does keep that old behavior but the variable usage is confusing.

    Changed to suppressNotif = false

  2. if (suppressNotif && error.response) {
    This is a confusing use of the variable suppressNotif. In this case, if suppressNotif is true (We want to suppress error messages), it will actually end up showing the error messages, and if it is false (we want to show the error messages), it actually hides all the error messages.

    Changed to if (!suppressNotif && error.response) {

  3. export const getUserDetails = (username: string, suppress? : true) => {
    This again defines an optional parameter suppress which has a type of undefined | true, instead it should be a Boolean parameter with default value of true
    Changed to export const getUserDetails = (username: string, suppress = true) => {

@Ashesh3 Ashesh3 requested a review from a team July 24, 2022 07:05
@Ashesh3 Ashesh3 requested a review from a team as a code owner July 24, 2022 07:05
@netlify
Copy link

netlify bot commented Jul 24, 2022

Deploy Preview for care-egov-staging ready!

Name Link
🔨 Latest commit fb3eb77
🔍 Latest deploy log https://app.netlify.com/sites/care-egov-staging/deploys/62e561d7465e35000a5f7d56
😎 Deploy Preview https://deploy-preview-3218--care-egov-staging.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@aeswibon
Copy link
Member

@Ashesh3 I have already fixed this issue in #3217

Copy link
Contributor

@developedBySJ developedBySJ left a comment

Choose a reason for hiding this comment

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

LGTM

@sonarcloud
Copy link

sonarcloud bot commented Jul 30, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.7% 0.7% Duplication

@aeswibon
Copy link
Member

aeswibon commented Aug 8, 2022

Closing this PR as it is already fixed in PR #3217

@aeswibon aeswibon closed this Aug 8, 2022
@Ashesh3
Copy link
Member Author

Ashesh3 commented Aug 8, 2022

@cp-Coder I missed your earlier comment, 😅 just noticed it's already fixed, good to close!

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

Successfully merging this pull request may close these issues.

None yet

4 participants