Skip to content

Commit

Permalink
fix: Intercom setting anonymous user a common user id (#36017)
Browse files Browse the repository at this point in the history
## Description

Avoids setting the `user_id` field in intercom when the user is not
logged in

Fixes appsmithorg/appsmith-ee#5003


## Automation

/ok-to-test tags="@tag.Sanity"

### 🔍 Cypress test results
<!-- This is an auto-generated comment: Cypress test results  -->
> [!IMPORTANT]
> 🟣 🟣 🟣 Your tests are running.
> Tests running at:
<https://github.com/appsmithorg/appsmith/actions/runs/10631847104>
> Commit: 1eaad31
> Workflow: `PR Automation test suite`
> Tags: `@tag.Sanity`
> Spec: ``
> <hr>Fri, 30 Aug 2024 11:26:34 UTC
<!-- end of auto-generated comment: Cypress test results  -->


## Communication
Should the DevRel and Marketing teams inform users about this change?
- [ ] Yes
- [ ] No


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **New Features**
- Enhanced user information handling for improved privacy in the
application.
- Anonymous users will no longer have their usernames processed,
ensuring greater data protection.

- **Bug Fixes**
- Refined logic for extracting user information to prevent exposure of
sensitive data.

- **Documentation**
- Updated comments and documentation to reflect changes in user data
handling and privacy measures.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
  • Loading branch information
hetunandu authored Aug 30, 2024
1 parent a9ca63c commit e69ca89
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions app/client/src/utils/bootIntercom.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { User } from "constants/userConstants";
import { ANONYMOUS_USERNAME, type User } from "constants/userConstants";
import { getAppsmithConfigs } from "ee/configs";
import { sha256 } from "js-sha256";
import { getLicenseKey } from "ee/utils/licenseHelpers";
Expand All @@ -7,9 +7,12 @@ const { appVersion, cloudHosting, intercomAppID } = getAppsmithConfigs();

export default function bootIntercom(user?: User) {
if (intercomAppID && window.Intercom) {
let { email, username } = user || {};
let name;
if (!cloudHosting) {
let name: string | undefined = user?.name;
let email: string | undefined = user?.email;
let username =
user?.username === ANONYMOUS_USERNAME ? undefined : user?.username;
if (!cloudHosting && username) {
// We are hiding their information when self-hosted
username = sha256(username || "");
// keep email undefined so that users are prompted to enter it when they reach out on intercom
email = undefined;
Expand Down

0 comments on commit e69ca89

Please sign in to comment.