-
Notifications
You must be signed in to change notification settings - Fork 1.2k
[backend/frontend] Creation of email templates and sending when creating a user (#11487) #11676
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
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #11676 +/- ##
==========================================
- Coverage 65.39% 65.35% -0.05%
==========================================
Files 730 736 +6
Lines 72703 73008 +305
Branches 8079 8106 +27
==========================================
+ Hits 47546 47713 +167
- Misses 25157 25295 +138 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
a2f446e to
9c8b4ba
Compare
54d01d0 to
1e69e12
Compare
6f5a5b9 to
18042b8
Compare
|
Feature to test :
|
...ncti-front/src/private/components/settings/email_template/EmailTemplateAttributesSidebar.tsx
Show resolved
Hide resolved
opencti-platform/opencti-graphql/src/manager/telemetryManager.ts
Outdated
Show resolved
Hide resolved
opencti-platform/opencti-graphql/src/modules/emailTemplate/emailTemplate-resolver.ts
Show resolved
Hide resolved
opencti-platform/opencti-graphql/src/manager/telemetryManager.ts
Outdated
Show resolved
Hide resolved
| } | ||
| }; | ||
|
|
||
| export const sendEmailToUser = async (context, user, input) => { |
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.
I wonder about moving that to emailTemplate domain.... it's not 100% accurate but I'm so sad when we continue to make this file bigger and bigger.
| throw UnsupportedError('Target user not found', { id: input.target_user_id }); | ||
| } | ||
|
|
||
| const organizationIds = targetUser['participate-to'] || []; |
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.
if you take user from cache, you don't need to do that.
const users = await getEntitiesListFromCache<AuthUser>(testContext, ADMIN_USER, ENTITY_TYPE_USER);
// then find your user.
| let organizationNames = []; | ||
| if (organizationIds.length > 0) { | ||
| const organizations = await Promise.all( | ||
| organizationIds.map((orgId) => internalLoadById(context, user, orgId)) | ||
| ); | ||
| organizationNames = organizations | ||
| .filter((org) => !!org) | ||
| .map((org) => org.name) | ||
| .filter((name) => !!name); | ||
| } |
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.
Would be better to do that only if objectOrganization is used in template
aHenryJard
left a comment
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.
Blocking PR until api_token is removed from email templates.
opencti-platform/opencti-front/src/private/components/common/form/EmailTemplateField.tsx
Show resolved
Hide resolved
25958a7 to
8ba6d28
Compare
aHenryJard
left a comment
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.
All good to me
…ing a user (OpenCTI-Platform#11487) (OpenCTI-Platform#11676) Co-authored-by: Jeremy Cloarec <jeremy.cloarec@filigran.io> Co-authored-by: Valentin Bouzin <valentin.bouzin@filigran.io>
Proposed changes
client PR OpenCTI-Platform/client-python#940
Related issues
Checklist
Further comments