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

AB#16252 - Email notifications next #1005

Open
wants to merge 82 commits into
base: 2.x.x
Choose a base branch
from

Conversation

AntoineRelief
Copy link
Collaborator

@AntoineRelief AntoineRelief commented Mar 25, 2024

Description

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.

Useful links

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Improvement (refactor or addition to existing functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce.

  • Test A
  • Test B

Screenshots

Please include screenshots of this change. If this issue is only back-end related, and does not involve any visual change of the platform, you can skip this part.

Checklist:

( * == Mandatory )

  • * I have set myself as assignee of the pull request
  • * My code follows the style guidelines of this project
  • * Linting does not generate new warnings
  • * I have performed a self-review of my own code
  • * I have put the ticket for review, adding the oort-backend team to the list of reviewers
  • * I have commented my code, particularly in hard-to-understand areas
  • * I have put JSDoc comment in all required places
  • * My changes generate no new warnings
  • * I have included screenshots describing my changes if relevant
  • * I have selected labels in the Pull Request, according to the changes with code brings
  • I have made corresponding changes to the documentation ( if required )
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

More explanation

https://www.loom.com/share/05a716d61b9744faaf51fb304c21d1e5?sid=f87cf896-582a-4f76-93ae-8ceed801b145

@HasnatL-Adapptlimited
Copy link
Collaborator

Hi @AntoineRelief , @MwanPygmay, @matheus-relief
cc: @morgang-adappt

The following changes have been implemented:

  • Legacy Styling Implemented (Emails display consistently across a majority of browsers)
  • Data Persisting fix in frontend, also made to the final email

@AntoineRelief AntoineRelief changed the title Email notifications next AB#16252 - Email notifications next Apr 23, 2024
Copy link
Collaborator

@Matthis-M-ReliefApps Matthis-M-ReliefApps left a comment

Choose a reason for hiding this comment

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

Hi @HasnatL-Adapptlimited,
Review done there too. The only thing that seems possibly critical to me is the permissions issue.
The naming changes on DB structure should also be done as early as possible to avoid the need of migrations.
Please let me know if any of my comments is unclear.
All the rest looks mostly good, thank you for your work!

case 'inthelast': {
if ([...DATE_TYPES, ...DATETIME_TYPES].includes(type)) {
const now = Date.now();
const withinTheLastMs = value * 60 * 1000;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Unclear variable naming to replace by "withinTheLastMinutes"

* @param userValue The user's input value
* @returns A string where all non-alphanumeric and non-hyphen characters are replaced with a whitespace.
*/
export const replaceUnderscores = (userValue: string): string => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Bad naming, should be "replaceByWhitespaces" or similar

Comment on lines 130 to 135
recipients: {
distributionListName: String,
To: [{ type: String }],
Cc: [{ type: String }],
Bcc: [{ type: String }],
},
Copy link
Collaborator

Choose a reason for hiding this comment

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

HIGH PRIORITY

I don't understand why the naming "recipients" is used there. Would it be possible to change it to "distributionList" directly, to keep the naming consistent and more straightfoward?
Then rename "distributionListName" to simply "name". The changed should be reflected everywhere needed in the code of course.

(putting as high priority because waiting before implementing this change could make it more troublesome to solve)

/**
*
*/
interface AddCustomNotificationArgs {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Naming is wrong

Copy link
Collaborator

Choose a reason for hiding this comment

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

Why is it "editAndGet"?
We have the separate folder "query" which contains the query to "get" the emailNotification. So I'm not sure of this file's naming?
If this is to signify that you return the updated object after edition, it makes sense. However if it's the only reason, please edit it so it sticks to the convention that we already use with the other mutations, just starting with "edit".

Comment on lines 57 to 58
// console.log('type resolver');
// console.log(parent.records);
Copy link
Collaborator

Choose a reason for hiding this comment

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

remove

Comment on lines 62 to 70
export const RecipientsType = new GraphQLObjectType({
name: 'Recipients',
fields: () => ({
distributionListName: { type: GraphQLString },
To: { type: new GraphQLList(GraphQLString) },
Cc: { type: new GraphQLList(GraphQLString) },
Bcc: { type: new GraphQLList(GraphQLString) },
}),
});
Copy link
Collaborator

Choose a reason for hiding this comment

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

Naming to fix as described in previous comment

Copy link
Collaborator

Choose a reason for hiding this comment

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

@AntoineRelief Is think this part of the code is/will be changed by a fix that Matthieu developed for the "today" function, you might have some merge conflict

Comment on lines 119 to 142
const formattedPastDate = pastDate.toLocaleDateString('en-US', {
year: 'numeric',
month: 'long',
day: '2-digit',
});

// Past Date to time (hh:mm)
const formattedPastTime = pastDate.toLocaleTimeString('en-US', {
hour: '2-digit',
minute: '2-digit',
});

// Current Date to date (mm/dd/yyyy)
const formattedCurrentDate = currentDate.toLocaleDateString('en-US', {
year: 'numeric',
month: 'long',
day: '2-digit',
});

// Current Date to time (hh:mm)
const formattedCurrentTime = currentDate.toLocaleTimeString('en-US', {
hour: '2-digit',
minute: '2-digit',
});
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could we make those localeFormats constants so they can be changed easily if required?

Comment on lines 147 to 149
newHeader = `From ${formattedPastDate} ${formattedCurrentTime} UTC as of ${formattedCurrentDate} ${formattedCurrentTime} UTC`;
} else {
newHeader = `From ${formattedPastDate} ${formattedPastTime} UTC as of ${formattedCurrentDate} ${formattedCurrentTime} UTC`;
Copy link
Collaborator

Choose a reason for hiding this comment

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

I didn't check by running the code, so I'm not too sure where they are displayed/used, but they probably should be translated when needed.

AntoineRelief and others added 21 commits May 27, 2024 14:29
…record to insert (#1075) (#1076)

Co-authored-by: Matthis M <80319175+Matthis-M-ReliefApps@users.noreply.github.com>
…ectly.

* Handle arrays of objects in formatDates

* Fix DB values showing instead of text

* Fix single string data being replaced (radionuclear)
AB#16252 - Email Notifications Phase 1 Fixes
fix: record validation would not be done correctly for some fields / …
## [2.10.3-rc.1](v2.10.2...v2.10.3-rc.1) (2024-06-06)

### Bug Fixes

* record validation would not be done correctly for some fields / requests, and make them fail AB[#95404](https://github.com/ReliefApplications/ems-backend/issues/95404) AB[#95398](https://github.com/ReliefApplications/ems-backend/issues/95398) ([2ecfe0f](2ecfe0f))
## [2.10.3-rc.2](v2.10.3-rc.1...v2.10.3-rc.2) (2024-06-06)

### Bug Fixes

* allow to skip validation of records ([35fe868](35fe868))
feat: allow null values in aggregation
# [2.11.0-rc.1](v2.10.3-rc.2...v2.11.0-rc.1) (2024-06-11)

### Bug Fixes

* Deleting resource breaks schema ([#1099](#1099)) ([595f294](595f294))

### Features

* allow null values in aggregation ([afe4656](afe4656))

### Reverts

* Revert "bug: Deleting resource breaks schema (#1099)" (#1101) ([e99b0dc](e99b0dc)), closes [#1099](#1099) [#1101](#1101)
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.

None yet

9 participants