settings_users: Support guest user in admin-user-table.

This supports guest user in the user-info-form-modal as well as in the
role section of the admin-user-table.

With some fixes by Tim Abbott and Shubham Dhama.
This commit is contained in:
Pragati Agrawal
2018-10-19 15:59:46 +05:30
committed by Tim Abbott
parent 553c50ebfb
commit d5df0377cc
10 changed files with 160 additions and 5 deletions

View File

@@ -482,6 +482,7 @@ def notify_created_user(user_profile: UserProfile) -> None:
avatar_url=avatar_url(user_profile),
timezone=user_profile.timezone,
date_joined=user_profile.date_joined.isoformat(),
is_guest=user_profile.is_guest,
is_bot=user_profile.is_bot)) # type: Dict[str, Any]
if not user_profile.is_bot:
event["person"]["profile_data"] = {}
@@ -3175,6 +3176,16 @@ def do_change_is_admin(user_profile: UserProfile, value: bool,
is_admin=value))
send_event(event, active_user_ids(user_profile.realm_id))
def do_change_is_guest(user_profile: UserProfile, value: bool) -> None:
user_profile.is_guest = value
user_profile.save(update_fields=["is_guest"])
event = dict(type="realm_user", op="update",
person=dict(email=user_profile.email,
user_id=user_profile.id,
is_guest=value))
send_event(event, active_user_ids(user_profile.realm_id))
def do_change_stream_invite_only(stream: Stream, invite_only: bool,
history_public_to_subscribers: Optional[bool]=None) -> None:
history_public_to_subscribers = get_default_value_for_history_public_to_subscribers(