Skip to content

Commit

Permalink
create default handle for workspaces on creation
Browse files Browse the repository at this point in the history
  • Loading branch information
nikochiko committed Dec 4, 2024
1 parent d093d64 commit 52297b1
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion workspaces/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from app_users.models import AppUser
from daras_ai_v2 import icons, settings
from daras_ai_v2.fastapi_tricks import get_route_path
from handles.models import COMMON_EMAIL_DOMAINS
from handles.models import COMMON_EMAIL_DOMAINS, Handle
from .models import Workspace, WorkspaceInvite, WorkspaceRole


Expand Down Expand Up @@ -114,6 +114,9 @@ def global_workspace_selector(user: AppUser, session: dict):
name = get_default_workspace_name_for_user(user)
workspace = Workspace(name=name, created_by=user)
workspace.create_with_owner()
workspace.handle = Handle.create_default_for_workspace(workspace)
if workspace.handle:
workspace.save()
session[SESSION_SELECTED_WORKSPACE] = workspace.id
raise gui.RedirectException(get_route_path(members_route))

Expand Down

0 comments on commit 52297b1

Please sign in to comment.