Skip to content

Commit

Permalink
code-optimize
Browse files Browse the repository at this point in the history
  • Loading branch information
r350178982 committed Jun 12, 2024
1 parent 5cbd3e7 commit 10d33ed
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
7 changes: 2 additions & 5 deletions seahub/api2/endpoints/admin/users.py
Original file line number Diff line number Diff line change
Expand Up @@ -2133,10 +2133,6 @@ class AdminUserConvertToTeamView(APIView):
throttle_classes = (UserRateThrottle,)

def post(self, request):
if not settings.ENABLE_CONVERT_TO_TEAM_ACCOUNT:
error_msg = 'Feature is not enabled.'
return api_error(status.HTTP_403_FORBIDDEN, error_msg)

username = request.data.get('email')
if not username:
return api_error(status.HTTP_400_BAD_REQUEST, 'email invalid.')
Expand Down Expand Up @@ -2170,7 +2166,8 @@ def post(self, request):
org_name = ''.join(nickname_characters)

try:
# 1. Create a new org
# 1. Create a new org, and add the user(username) to org as a team admin
# by ccnet_api.create_org
org_id = ccnet_api.create_org(org_name, url_prefix, username)
# 2. Update org-settings
new_org = ccnet_api.get_org_by_id(org_id)
Expand Down
3 changes: 2 additions & 1 deletion seahub/api2/endpoints/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,8 @@ def post(self, request):
org_name = ''.join(nickname_characters)

try:
# 1. Create a new org
# 1. Create a new org, and add the current to org as a team admin
# by ccnet_api.create_org
org_id = ccnet_api.create_org(org_name, url_prefix, username)
# 2. Update org-settings
new_org = ccnet_api.get_org_by_id(org_id)
Expand Down

0 comments on commit 10d33ed

Please sign in to comment.