mirror of https://github.com/zulip/zulip.git
actions: Split out zerver.actions.video_calls.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
parent
c136eebb33
commit
90cae59ea6
|
@ -0,0 +1,14 @@
|
|||
from typing import Dict, Optional
|
||||
|
||||
from zerver.models import UserProfile
|
||||
from zerver.tornado.django_api import send_event
|
||||
|
||||
|
||||
def do_set_zoom_token(user: UserProfile, token: Optional[Dict[str, object]]) -> None:
|
||||
user.zoom_token = token
|
||||
user.save(update_fields=["zoom_token"])
|
||||
send_event(
|
||||
user.realm,
|
||||
dict(type="has_zoom_token", value=token is not None),
|
||||
[user.id],
|
||||
)
|
|
@ -8742,16 +8742,6 @@ def do_send_realm_reactivation_email(realm: Realm, *, acting_user: Optional[User
|
|||
)
|
||||
|
||||
|
||||
def do_set_zoom_token(user: UserProfile, token: Optional[Dict[str, object]]) -> None:
|
||||
user.zoom_token = token
|
||||
user.save(update_fields=["zoom_token"])
|
||||
send_event(
|
||||
user.realm,
|
||||
dict(type="has_zoom_token", value=token is not None),
|
||||
[user.id],
|
||||
)
|
||||
|
||||
|
||||
def notify_realm_export(user_profile: UserProfile) -> None:
|
||||
# In the future, we may want to send this event to all realm admins.
|
||||
event = dict(type="realm_export", exports=get_realm_exports_serialized(user_profile))
|
||||
|
|
|
@ -107,7 +107,7 @@ def clear_zoom_token_on_logout(
|
|||
sender: object, *, user: Optional[UserProfile], **kwargs: object
|
||||
) -> None:
|
||||
# Loaded lazily so django.setup() succeeds before static asset generation
|
||||
from zerver.lib.actions import do_set_zoom_token
|
||||
from zerver.actions.video_calls import do_set_zoom_token
|
||||
|
||||
if user is not None and user.zoom_token is not None:
|
||||
do_set_zoom_token(user, None)
|
||||
|
|
|
@ -13,6 +13,7 @@ from unittest import mock
|
|||
import orjson
|
||||
from django.utils.timezone import now as timezone_now
|
||||
|
||||
from zerver.actions.video_calls import do_set_zoom_token
|
||||
from zerver.lib.actions import (
|
||||
bulk_add_members_to_user_group,
|
||||
bulk_add_subscriptions,
|
||||
|
@ -83,7 +84,6 @@ from zerver.lib.actions import (
|
|||
do_set_realm_property,
|
||||
do_set_realm_signup_notifications_stream,
|
||||
do_set_realm_user_default_setting,
|
||||
do_set_zoom_token,
|
||||
do_unmute_topic,
|
||||
do_unmute_user,
|
||||
do_update_embedded_data,
|
||||
|
|
|
@ -22,8 +22,8 @@ from django.views.decorators.http import require_POST
|
|||
from oauthlib.oauth2 import OAuth2Error
|
||||
from requests_oauthlib import OAuth2Session
|
||||
|
||||
from zerver.actions.video_calls import do_set_zoom_token
|
||||
from zerver.decorator import zulip_login_required
|
||||
from zerver.lib.actions import do_set_zoom_token
|
||||
from zerver.lib.exceptions import ErrorCode, JsonableError
|
||||
from zerver.lib.outgoing_http import OutgoingSession
|
||||
from zerver.lib.pysa import mark_sanitized
|
||||
|
|
Loading…
Reference in New Issue