feat: Add Appsmith version to fetch user feature flags request (#29603)

## Description
PR to add the Appsmith version trait while fetching the flags from user
project.

CS PR: https://github.com/appsmithorg/cloud-services/pull/1503

#### PR fixes following issue(s)
Fixes https://github.com/appsmithorg/appsmith/issues/29412

#### Type of change
- New feature (non-breaking change which adds functionality)

## Testing
#### How Has This Been Tested?
> Please describe the tests that you ran to verify your changes. Also
list any relevant details for your test configuration.
> Delete anything that is not relevant
- [x] Manual
- [ ] JUnit
- [ ] Jest
- [ ] Cypress

## Checklist:
#### Dev activity
- [ ] My code follows the style guidelines of this project
- [x] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [ ] New and existing unit tests pass locally with my changes
- [ ] PR is being merged under a feature flag


#### QA activity:
- [ ] [Speedbreak
features](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#speedbreakers-)
have been covered
- [ ] Test plan covers all impacted features and [areas of
interest](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#areas-of-interest-)
- [ ] Test plan has been peer reviewed by project stakeholders and other
QA members
- [ ] Manually tested functionality on DP
- [ ] We had an implementation alignment call with stakeholders post QA
Round 2
- [ ] Cypress test cases have been added and approved by SDET/manual QA
- [ ] Added `Test Plan Approved` label after Cypress tests were reviewed
- [ ] Added `Test Plan Approved` label after JUnit tests were reviewed


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

- **New Features**
- Feature flags now consider the app version to provide a more tailored
experience.

- **Refactor**
- Enhanced the feature flag management logic for better performance and
reliability.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
Abhijeet 2023-12-15 10:12:00 +05:30 committed by GitHub
parent b4441969d0
commit a9a7e193e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 2 deletions

View File

@ -21,4 +21,5 @@ public class FeatureFlagIdentityTraits {
String tenantId;
Set<String> userIdentifiers;
Map<String, Object> traits;
String appsmithVersion;
}

View File

@ -116,8 +116,10 @@ public class CacheableFeatureFlagHelperCEImpl implements CacheableFeatureFlagHel
return Mono.zip(instanceIdMono, defaultTenantMono, getUserDefaultTraits(user))
.flatMap(objects -> {
String tenantId = objects.getT2().getId();
return this.getRemoteFeatureFlagsByIdentity(new FeatureFlagIdentityTraits(
objects.getT1(), tenantId, Set.of(userIdentifier), objects.getT3()));
String appsmithVersion = releaseNotesService.getRunningVersion();
FeatureFlagIdentityTraits featureFlagIdentityTraits = new FeatureFlagIdentityTraits(
objects.getT1(), tenantId, Set.of(userIdentifier), objects.getT3(), appsmithVersion);
return this.getRemoteFeatureFlagsByIdentity(featureFlagIdentityTraits);
})
.map(newValue -> ObjectUtils.defaultIfNull(newValue.get(userIdentifier), Map.of()));
}