[Question]: I can't understand meaning of `tenants = UserTenantService.query(user_id=current_user.id)`
Describe your problem
There are many places will query tenant by this way
However, when I review the invite logic, I realized that it is querying the first tenant that the user has joined.
The question is, why should we check the "first" tenant that the user has joined? I think it is not stable to depend on the order.
For now, there's only one tenant will be returned.
I'm still in 0.16.0, In my test, it returned 3 tenant after I joined 2 other teams.
should it be changed to tenants = UserTenantService.query(user_id=current_user.id, role=UserTenantRole.OWNER)?
I can make a PR.
Actually in my case, I forcely add a default UserTenant during registration, so when ragflow query the first one (It may sorted by time? idk), it broke.
I think it just not robust to depend on the returning order.