Orgs: some small fixes, mostly for stability / corner cases
This commit is contained in:
parent
e9cb235640
commit
4116357447
@ -115,7 +115,7 @@ class OrgManager:
|
||||
|
||||
# Compute the new members.
|
||||
members = set(org_doc.get('members') or []) | existing_users
|
||||
unknown_members = set(org_doc.get('unknown_members')) | unknown_users
|
||||
unknown_members = set(org_doc.get('unknown_members') or []) | unknown_users
|
||||
|
||||
# Make sure we don't exceed the current seat count.
|
||||
new_seat_count = len(members) + len(unknown_members)
|
||||
@ -270,7 +270,7 @@ class OrgManager:
|
||||
return False
|
||||
|
||||
org = self._get_org(org_id, projection={'admin_uid': 1})
|
||||
return org['admin_uid'] == uid
|
||||
return org.get('admin_uid') == uid
|
||||
|
||||
def unknown_member_roles(self, member_email: str) -> typing.Set[str]:
|
||||
"""Returns the set of organization roles for this user.
|
||||
@ -321,6 +321,9 @@ class OrgManager:
|
||||
"""
|
||||
from pillar.api.utils import str2id
|
||||
|
||||
if not member_sting_ids:
|
||||
return []
|
||||
|
||||
member_ids = [str2id(uid) for uid in member_sting_ids]
|
||||
users_coll = current_app.db('users')
|
||||
users = users_coll.find({'_id': {'$in': member_ids}},
|
||||
|
@ -55,6 +55,9 @@ def view_embed(organization_id: str):
|
||||
member['avatar'] = gravatar(member.get('email'))
|
||||
member['_id'] = str(member['_id'])
|
||||
|
||||
# Make sure it's never None
|
||||
organization.unknown_members = organization.unknown_members or []
|
||||
|
||||
can_edit = om.user_is_admin(organization_oid)
|
||||
|
||||
csrf = flask_wtf.csrf.generate_csrf()
|
||||
|
@ -43,7 +43,7 @@
|
||||
|
||||
#item-action-panel
|
||||
| {% if can_create_organization %}
|
||||
button.btn(onclick='createNewOrganization(this)') Create new organization (max {{max_organizations}})
|
||||
button.btn(onclick='createNewOrganization(this)') Create new organization
|
||||
#create_organization_result_panel
|
||||
| {% endif %}
|
||||
|
||||
@ -151,7 +151,7 @@ script.
|
||||
|
||||
// TODO: create a form to get the initial info from the user.
|
||||
$.post(
|
||||
'{{ url_for('pillar.organizations.create_new') }}',
|
||||
'{{ url_for('pillar.web.organizations.create_new') }}',
|
||||
{
|
||||
name: 'New Organization',
|
||||
seat_count: 1,
|
||||
|
@ -52,8 +52,7 @@
|
||||
.table-row.properties-org-roles
|
||||
.table-cell User roles
|
||||
.table-cell(title='Unable to edit, determined by subscription')
|
||||
| {{ organization.org_roles | sort | join(', ') }}
|
||||
|
||||
| {{ organization.org_roles | hide_none | sort | join(', ') }}
|
||||
|
||||
.flamenco-box.manager
|
||||
h4 Organization members
|
||||
|
Loading…
x
Reference in New Issue
Block a user