chore: revert of static anonymous user profile (#39945)

## Description
> [!TIP]  
> _Add a TL;DR when the description is longer than 500 words or
extremely technical (helps the content, marketing, and DevRel team)._
>
> _Please also include relevant motivation and context. List any
dependencies that are required for this change. Add links to Notion,
Figma or any other documents that might be relevant to the PR._


Fixes #`Issue Number`  
_or_  
Fixes `Issue URL`
> [!WARNING]  
> _If no issue exists, please create an issue first, and check with the
maintainers if the issue is valid._

## Automation

/test sanity

### 🔍 Cypress test results
<!-- This is an auto-generated comment: Cypress test results  -->
> [!TIP]
> 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
> Workflow run:
<https://github.com/appsmithorg/appsmith/actions/runs/14097801414>
> Commit: 5d5bdb6c6720d3975487fd58c77f7cdcf53474d1
> <a
href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=14097801414&attempt=1"
target="_blank">Cypress dashboard</a>.
> Tags: `@tag.Sanity`
> Spec:
> <hr>Thu, 27 Mar 2025 03:29:53 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

- **Refactor**
- Streamlined user profile generation by removing support for anonymous
user profiles.
- Profiles are now exclusively built using verified user data, ensuring
a more consistent experience for authenticated users.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
Trisha Anand 2025-03-27 11:42:27 +05:30 committed by GitHub
parent 5a6d755980
commit afad67b434
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -715,12 +715,7 @@ public class UserServiceCEImpl extends BaseService<UserRepository, User, String>
@Override
public Mono<UserProfileDTO> buildUserProfileDTO(User user) {
// For anonymous users, build the profile directly from the in-memory user object
if (user.isAnonymous()) {
return getAnonymousUserProfile(user);
}
// For regular users, proceed with the existing flow
Mono<User> userFromDbMono = findByEmail(user.getEmail()).cache();
Mono<Boolean> isSuperUserMono =
@ -760,22 +755,6 @@ public class UserServiceCEImpl extends BaseService<UserRepository, User, String>
});
}
protected Mono<UserProfileDTO> getAnonymousUserProfile(User user) {
return this.isUsersEmpty().map(isUsersEmpty -> {
UserProfileDTO profile = new UserProfileDTO();
profile.setEmail(user.getEmail());
profile.setUsername(user.getUsername());
profile.setAnonymous(true);
profile.setEnabled(user.isEnabled());
profile.setEnableTelemetry(!commonConfig.isTelemetryDisabled());
profile.setEmptyInstance(isUsersEmpty);
// Intercom consent is defaulted to true on cloud hosting
profile.setIntercomConsentGiven(commonConfig.isCloudHosting());
return profile;
});
}
private EmailTokenDTO parseValueFromEncryptedToken(String encryptedToken) {
String decryptString = EncryptionHelper.decrypt(encryptedToken);
List<NameValuePair> nameValuePairs = WWWFormCodec.parse(decryptString, StandardCharsets.UTF_8);