Kevin Hu commited on
Commit
0a519de
·
1 Parent(s): 822e2e9

Fix abnormal user invitaion message. (#4081)

Browse files

### What problem does this PR solve?

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)

Files changed (1) hide show
  1. api/apps/tenant_app.py +3 -1
api/apps/tenant_app.py CHANGED
@@ -62,8 +62,10 @@ def create(tenant_id):
62
  user_id = usrs[0].id
63
  user_tenants = UserTenantService.query(user_id=user_id, tenant_id=tenant_id)
64
  if user_tenants:
65
- if user_tenants[0].status == UserTenantRole.NORMAL.value:
66
  return get_data_error_result(message="This user is in the team already.")
 
 
67
  return get_data_error_result(message="Invitation notification is sent.")
68
 
69
  UserTenantService.save(
 
62
  user_id = usrs[0].id
63
  user_tenants = UserTenantService.query(user_id=user_id, tenant_id=tenant_id)
64
  if user_tenants:
65
+ if user_tenants[0].role == UserTenantRole.NORMAL:
66
  return get_data_error_result(message="This user is in the team already.")
67
+ if user_tenants[0].role == UserTenantRole.OWNER:
68
+ return get_data_error_result(message="This user is the owner of the team.")
69
  return get_data_error_result(message="Invitation notification is sent.")
70
 
71
  UserTenantService.save(