chore: Allow side effects for organization configuration updates (#39692)

## 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

/ok-to-test tags="@tag.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/13811137863>
> Commit: a3ebf0a5d43432f69a8563293531dead950c8213
> <a
href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=13811137863&attempt=1"
target="_blank">Cypress dashboard</a>.
> Tags: `@tag.Sanity`
> Spec:
> <hr>Wed, 12 Mar 2025 12:56:52 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 the organization settings update process to ensure all
related actions are executed smoothly, improving overall administrative
consistency.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
Nidhi 2025-03-13 00:45:54 +05:30 committed by GitHub
parent 091c146309
commit 472edcf913
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -29,6 +29,8 @@ import reactor.core.observability.micrometer.Micrometer;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import static com.appsmith.external.constants.spans.OrganizationSpan.FETCH_DEFAULT_ORGANIZATION_SPAN;
@ -116,6 +118,11 @@ public class OrganizationServiceCEImpl extends BaseService<OrganizationRepositor
.flatMap(tuple2 -> {
Organization organization = tuple2.getT2();
OrganizationConfiguration oldConfig = tuple2.getT1();
List<Mono<Boolean>> sideEffectsMonos =
calculateOrganizationConfigurationUpdateSideEffects(oldConfig, organizationConfiguration);
Mono<List<Boolean>> allSideEffectsMono =
Flux.fromIterable(sideEffectsMonos).flatMap(x -> x).collectList();
AppsmithBeanUtils.copyNestedNonNullProperties(organizationConfiguration, oldConfig);
organization.setOrganizationConfiguration(oldConfig);
Mono<Organization> updatedOrganizationMono = repository
@ -126,10 +133,16 @@ public class OrganizationServiceCEImpl extends BaseService<OrganizationRepositor
// hence it will not be evaluated again
return updatedOrganizationMono
.then(Mono.defer(() -> evictOrganizationCache))
.then(Mono.defer(() -> allSideEffectsMono))
.then(updatedOrganizationMono);
});
}
protected List<Mono<Boolean>> calculateOrganizationConfigurationUpdateSideEffects(
OrganizationConfiguration oldConfig, OrganizationConfiguration organizationConfiguration) {
return new ArrayList<>();
}
@Override
public Mono<Organization> findById(String organizationId, AclPermission permission) {
return repository
@ -243,6 +256,7 @@ public class OrganizationServiceCEImpl extends BaseService<OrganizationRepositor
// Only copy the values that are pertinent to the client
organizationConfiguration.copyNonSensitiveValues(dbOrganization.getOrganizationConfiguration());
clientOrganization.setId(dbOrganization.getId());
clientOrganization.setUserPermissions(dbOrganization.getUserPermissions());
return Mono.just(clientOrganization);