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 replaceSupportEmail function #4689

Merged
merged 9 commits into from Nov 1, 2023

Conversation

magicznyleszek
Copy link
Member

@magicznyleszek magicznyleszek commented Oct 18, 2023

Checklist

  1. If you've added code that should be tested, add tests
  2. If you've changed APIs, update (or create!) the documentation
  3. Ensure the tests pass
  4. Make sure that your code lints and that you've followed our coding style
  5. Write a title and, if necessary, a description of your work suitable for publishing in our release notes
  6. Mention any related issues in this repository (as #ISSUE) and in other repositories (as kobotoolbox/other#ISSUE)
  7. Open an issue in the docs if there are UI/UX changes

Description

Makes the constanse setting SUPPORT_EMAIL being displayed in error notifications.

Notes

Changes here:

  • Had to move some things around to avoid circular dependency errors:
    • handleApiFail from js/utils to js/api
    • some text related functions were moved from js/utils to js/textUtils, because replaceSupportEmail requires envStore, and importing it into js/utils is causing dependency errors. I created new file for general text related utility functions and moved ones that will not require refactor.
  • envStore is not using actions anymore, just making direct call with api.ts
  • replaceSupportEmail is using email from environment endpoint
  • removed getEnvironment Reflux action :)

Related issues

Fixes #3910

@magicznyleszek magicznyleszek marked this pull request as ready for review October 19, 2023 09:33
@magicznyleszek magicznyleszek linked an issue Oct 19, 2023 that may be closed by this pull request
@magicznyleszek magicznyleszek mentioned this pull request Oct 24, 2023
@magicznyleszek magicznyleszek requested review from LMNTL and removed request for srartese October 24, 2023 22:56
@magicznyleszek magicznyleszek assigned LMNTL and unassigned srartese Oct 24, 2023
Comment on lines 167 to 170
} catch (err) {
const errorObj = err as FailResponse;
handleApiFail(errorObj);
}
Copy link
Contributor

@LMNTL LMNTL Oct 25, 2023

Choose a reason for hiding this comment

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

This catch block is kind of redundant - because fetchGet() (without the notifyAboutError option set to false) already calls handleApiFail(). So if I make the /environment endpoint error, I see two error notifications:

image

Copy link
Member Author

Choose a reason for hiding this comment

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

Right! Pushed a fix :)

@magicznyleszek magicznyleszek merged commit a3b435d into beta Nov 1, 2023
1 of 4 checks passed
@magicznyleszek magicznyleszek deleted the 3910-fix-replace-support-email-function branch November 1, 2023 14:57
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.

Improve replaceSupportEmail utility function
3 participants