2024-08-09 09:16:18 +02:00
|
|
|
from django.db import transaction
|
|
|
|
|
2022-04-14 23:29:39 +02:00
|
|
|
from zerver.models import UserProfile
|
2024-08-09 09:16:18 +02:00
|
|
|
from zerver.tornado.django_api import send_event_on_commit
|
2022-04-14 23:29:39 +02:00
|
|
|
|
|
|
|
|
2024-08-09 09:16:18 +02:00
|
|
|
@transaction.atomic(durable=True)
|
2024-07-12 02:30:23 +02:00
|
|
|
def do_set_zoom_token(user: UserProfile, token: dict[str, object] | None) -> None:
|
2022-04-14 23:29:39 +02:00
|
|
|
user.zoom_token = token
|
|
|
|
user.save(update_fields=["zoom_token"])
|
2024-08-09 09:16:18 +02:00
|
|
|
send_event_on_commit(
|
2022-04-14 23:29:39 +02:00
|
|
|
user.realm,
|
|
|
|
dict(type="has_zoom_token", value=token is not None),
|
|
|
|
[user.id],
|
|
|
|
)
|