Skip to content

Conversation

@Gwendoline-FAVRE-FELIX
Copy link
Member

@Gwendoline-FAVRE-FELIX Gwendoline-FAVRE-FELIX commented Jul 15, 2025

Proposed changes

  • add new screens and a new module for email template management
  • add ability to send email to user with a selected template: during creation, in user page, and in background tasks

client PR OpenCTI-Platform/client-python#940

Related issues

Checklist

  • I consider the submitted work as finished
  • I tested the code for its functionality
  • I wrote test cases for the relevant uses case (coverage and e2e)
  • I added/update the relevant documentation (either on github or on notion)
  • Where necessary I refactored code to improve the overall quality

Further comments

@codecov
Copy link

codecov bot commented Jul 15, 2025

Codecov Report

❌ Patch coverage is 60.94276% with 116 lines in your changes missing coverage. Please review.
✅ Project coverage is 65.35%. Comparing base (b8e0a14) to head (433a673).
⚠️ Report is 14 commits behind head on master.

Files with missing lines Patch % Lines
...pencti-platform/opencti-graphql/src/domain/user.js 7.79% 71 Missing ⚠️
...c/modules/emailTemplate/emailTemplate-converter.ts 27.27% 16 Missing ⚠️
...rm/opencti-graphql/src/manager/telemetryManager.ts 80.00% 6 Missing ⚠️
...rm/opencti-graphql/src/manager/activityListener.ts 16.66% 5 Missing ⚠️
...latform/opencti-graphql/src/manager/taskManager.js 16.66% 5 Missing ⚠️
.../src/modules/emailTemplate/emailTemplate-domain.ts 88.63% 5 Missing ⚠️
...pencti-graphql/src/domain/backgroundTask-common.js 50.00% 2 Missing ⚠️
...rc/modules/emailTemplate/emailTemplate-resolver.ts 91.66% 2 Missing ⚠️
...graphql/src/modules/emailTemplate/emailTemplate.ts 93.75% 2 Missing ⚠️
...cti-platform/opencti-graphql/src/resolvers/user.js 33.33% 2 Missing ⚠️
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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@JeremyCloarec JeremyCloarec force-pushed the issue/11487 branch 2 times, most recently from a2f446e to 9c8b4ba Compare July 23, 2025 10:04
@JeremyCloarec JeremyCloarec added the multi-repository For contribution that requires PR in several repository label Jul 23, 2025
@JeremyCloarec JeremyCloarec force-pushed the issue/11487 branch 4 times, most recently from 54d01d0 to 1e69e12 Compare July 25, 2025 08:39
@JeremyCloarec JeremyCloarec marked this pull request as ready for review July 25, 2025 12:08
@JeremyCloarec JeremyCloarec force-pushed the issue/11487 branch 2 times, most recently from 6f5a5b9 to 18042b8 Compare July 25, 2025 15:36
@ValentinBouzinFiligran
Copy link
Member

Feature to test :

  • Email template creation
  • Test email sent to current user
  • Email template selection on user creation drawer ( and verification of email reception )
  • Email Template selection on user datatable for massive operation ( sent with Background Task )
    => user datatable are on user page and on an organization ( security section )

}
};

export const sendEmailToUser = async (context, user, input) => {
Copy link
Member

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'] || [];
Copy link
Member

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.

Comment on lines 561 to 570
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);
}
Copy link
Member

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

Copy link
Member

@aHenryJard aHenryJard left a 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.

@aHenryJard aHenryJard self-requested a review August 1, 2025 07:15
@aHenryJard aHenryJard dismissed their stale review August 1, 2025 07:15

ok I got answers

Copy link
Member

@aHenryJard aHenryJard left a 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

@JeremyCloarec JeremyCloarec merged commit 8bde773 into master Aug 14, 2025
11 checks passed
@JeremyCloarec JeremyCloarec deleted the issue/11487 branch August 14, 2025 12:01
efaure pushed a commit to efaure/opencti that referenced this pull request Sep 19, 2025
…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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

filigran team use to identify PR from the Filigran team multi-repository For contribution that requires PR in several repository

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants