settings: Replace invite_by_admins_policy with invite_to_realm_policy.

This commit replaces invite_by_admins_policy, which was a bool field,
with a new enum field invite_by_realm_policy.

Though the final goal is to add moderators and full members option
using COMMON_POLICY_TYPES, but this will be done in a separate
commit to make this easy for review.
This commit is contained in:
sahil839
2021-04-02 22:17:08 +05:30
committed by Tim Abbott
parent d4248cf060
commit 4c8339fa8c
17 changed files with 165 additions and 35 deletions

View File

@@ -349,7 +349,7 @@ def compute_show_invites_and_add_streams(user_profile: Optional[UserProfile]) ->
if user_profile.is_realm_admin:
return True, True
if user_profile.realm.invite_by_admins_only:
if user_profile.realm.invite_to_realm_policy == Realm.INVITE_TO_REALM_ADMINS_ONLY:
return False, True
return True, True