feat: Add default workspace name generation functionality (#40146)

## Description
> chore: Implemented a new method to generate a default workspace name
based on the user's first name. This feature enhances the workspace
creation process by providing a personalized name for new workspaces.


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/14317745936>
> Commit: d96ed2dc437871adcde8d8c78a6f4ae3990112d1
> <a
href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=14317745936&attempt=1"
target="_blank">Cypress dashboard</a>.
> Tags: `@tag.Sanity`
> Spec:
> <hr>Mon, 07 Apr 2025 20:03:51 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 default workspace naming: When creating a workspace, the
system now generates a more personalized name based on your first name.
- Improved workspace creation process: The new asynchronous naming
approach ensures a consistent and streamlined experience when workspaces
are auto-generated.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

Co-authored-by: Nilesh Sarupriya <20905988+nsarupr@users.noreply.github.com>
This commit is contained in:
Nilesh Sarupriya 2025-04-08 01:47:23 +05:30 committed by GitHub
parent ba4e29fb82
commit f644b15ef7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 15 additions and 3 deletions

View File

@ -4,4 +4,6 @@ import reactor.core.publisher.Mono;
public interface WorkspaceServiceHelperCE {
Mono<Boolean> isCreateWorkspaceAllowed(Boolean isDefaultWorkspace);
Mono<String> generateDefaultWorkspaceName(String firstName);
}

View File

@ -14,4 +14,10 @@ public class WorkspaceServiceHelperCEImpl implements WorkspaceServiceHelperCE {
public Mono<Boolean> isCreateWorkspaceAllowed(Boolean isDefaultWorkspace) {
return Mono.just(TRUE);
}
@Override
public Mono<String> generateDefaultWorkspaceName(String firstName) {
// Default implementation returns "x's apps"
return Mono.just(firstName + "'s apps");
}
}

View File

@ -123,9 +123,13 @@ public class WorkspaceServiceCEImpl extends BaseService<WorkspaceRepository, Wor
*/
@Override
public Mono<Workspace> createDefault(final Workspace workspace, User user) {
workspace.setName(user.computeFirstName() + "'s apps");
workspace.setIsAutoGeneratedWorkspace(true);
return create(workspace, user, TRUE);
return workspaceServiceHelper
.generateDefaultWorkspaceName(user.computeFirstName())
.flatMap(name -> {
workspace.setName(name);
workspace.setIsAutoGeneratedWorkspace(true);
return create(workspace, user, TRUE);
});
}
/**