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

5748 Create contacts for emails sent and received by email aliases #5855

Open
wants to merge 24 commits into
base: main
Choose a base branch
from

Conversation

bosiraphael
Copy link
Contributor

@bosiraphael bosiraphael commented Jun 13, 2024

Closes #5748

  • Create feature flag
  • Add scope https://www.googleapis.com/auth/profile.emails.read when connecting an account
  • Get email aliases with google people API, store them in connectedAccount and refresh them before each message-import
  • Update the contact creation logic accordingly
  • Refactor

Copy link

github-actions bot commented Jun 13, 2024

TODOs/FIXMEs:

  • // TODO: This does not handle all thread merging use cases and might create orphan threads.: packages/twenty-server/src/modules/messaging/common/services/messaging-message.service.ts

Generated by 🚫 dangerJS against c9fd241

…es-are-not-associated-with-the-workspacemember
Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

PR Summary

  • Introduced feature flag IsProfileEmailsReadEnabled
  • Updated Google API integration to handle email aliases
  • Refactored contact creation logic to include email aliases
  • Added services and modules for managing email aliases and OAuth2 clients
  • Enhanced message import process to support email aliases and feature flags

30 file(s) reviewed, 9 comment(s)

Comment on lines +22 to +26
const featureFlag = await this.featureFlagRepository.findOneBy({
workspaceId,
key,
value: true,
});
Copy link

Choose a reason for hiding this comment

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

Consider handling potential errors from the database query.

Comment on lines +18 to +19
const oAuth2Client =
await this.oAuth2ClientManagerService.getOAuth2Client(connectedAccount);
Copy link

Choose a reason for hiding this comment

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

Consider adding error handling for the OAuth2 client retrieval.

Comment on lines +26 to +29
const emailsResponse = await people.people.get({
resourceName: 'people/me',
personFields: 'emailAddresses',
});
Copy link

Choose a reason for hiding this comment

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

Add error handling for the API call to people.people.get to manage potential failures.

Comment on lines +18 to +21
const oAuth2Client = new google.auth.OAuth2(
gmailClientId,
gmailClientSecret,
);
Copy link

Choose a reason for hiding this comment

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

Add error handling for OAuth2 client creation.

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

PR Summary

(updates since last review)

  • Corrected error message to reference connectedAccountId
  • Retrieve connectedAccount using connectedAccountRepository before refreshing access token

1 file(s) reviewed, no comment(s)

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

PR Summary

(updates since last review)

  • Removed GoogleAPIsProviderEnabledGuard from google-apis-auth.controller.ts
  • Introduced feature flag checks in google-apis-oauth.guard.ts
  • Updated contact creation logic to include email aliases
  • Deleted google-apis-provider-enabled.guard.ts
  • Potential security issue: googleAuthGetAccessToken method now has no guards applied

3 file(s) reviewed, no comment(s)

…es-are-not-associated-with-the-workspacemember
Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

PR Summary

(updates since last review)

  • Added feature flag for email alias handling
  • Updated contact creation logic to include email aliases
  • Replaced custom tooltips with AppTooltip from twenty-ui
  • Introduced new GraphQL filter types and operands
  • Added unit tests for various utility functions and components

196 file(s) reviewed, no comment(s)

…es-are-not-associated-with-the-workspacemember
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.

Emails sent and received by email aliases are not associated with the workspaceMember
2 participants