mirror of
https://github.com/lucaspalomodevelop/indico-plugins.git
synced 2026-03-13 07:29:39 +00:00
VC/Zoom: Do not clone deleted meetings/VCRooms
This commit is contained in:
parent
3590fc71e7
commit
ec5e05afeb
@ -28,6 +28,7 @@
|
||||
- Remove the "Assistant Zoom ID" logic due to problems with Zoom's API rate limits (all meetings created were counted against the assistant's rate limit instead of the host's); this means the host can no longer be changed, but Indico instead provides an option to event managers to make themselves a co-host.
|
||||
- Fix an error when changing the linked object of a recurring Zoom room in Indico
|
||||
- Include Zoom join links in the event's ical export (note: only Zoom meetings with a public passcode are displayed unless you have at least Indico v2.3.3)
|
||||
- Skip deleted Zoom meetings when cloning events
|
||||
|
||||
**Breaking change:** The email domains are now stored as a list of strings instead of a comma-separated list. You need to update them in the plugin settings.
|
||||
|
||||
|
||||
@ -21,8 +21,8 @@ from indico.core.auth import multipass
|
||||
from indico.core.plugins import IndicoPlugin, render_plugin_template, url_for_plugin
|
||||
from indico.modules.events.views import WPSimpleEventDisplay
|
||||
from indico.modules.vc import VCPluginMixin, VCPluginSettingsFormBase
|
||||
from indico.modules.vc.exceptions import VCRoomError
|
||||
from indico.modules.vc.models.vc_rooms import VCRoom
|
||||
from indico.modules.vc.exceptions import VCRoomError, VCRoomNotFoundError
|
||||
from indico.modules.vc.models.vc_rooms import VCRoom, VCRoomStatus
|
||||
from indico.modules.vc.views import WPVCEventPage, WPVCManageEvent
|
||||
from indico.util.user import principal_from_identifier
|
||||
from indico.web.forms.fields import IndicoEnumSelectField, IndicoPasswordField, TextListField
|
||||
@ -424,20 +424,31 @@ class ZoomPlugin(VCPluginMixin, IndicoPlugin):
|
||||
vc_room = old_event_vc_room.vc_room
|
||||
is_webinar = vc_room.data.get('meeting_type', 'regular') == 'webinar'
|
||||
has_only_one_association = len({assoc.event_id for assoc in vc_room.events}) == 1
|
||||
new_assoc = super(ZoomPlugin, self).clone_room(old_event_vc_room, link_object)
|
||||
|
||||
if has_only_one_association:
|
||||
update_zoom_meeting(vc_room.data['zoom_id'], {
|
||||
'start_time': None,
|
||||
'duration': None,
|
||||
'type': (
|
||||
ZoomMeetingType.recurring_webinar_no_time
|
||||
if is_webinar
|
||||
else ZoomMeetingType.recurring_meeting_no_time
|
||||
)
|
||||
})
|
||||
|
||||
return new_assoc
|
||||
try:
|
||||
update_zoom_meeting(vc_room.data['zoom_id'], {
|
||||
'start_time': None,
|
||||
'duration': None,
|
||||
'type': (
|
||||
ZoomMeetingType.recurring_webinar_no_time
|
||||
if is_webinar
|
||||
else ZoomMeetingType.recurring_meeting_no_time
|
||||
)
|
||||
})
|
||||
except VCRoomNotFoundError:
|
||||
# this check is needed in order to avoid multiple flashes
|
||||
if vc_room.status != VCRoomStatus.deleted:
|
||||
# mark room as deleted
|
||||
vc_room.status = VCRoomStatus.deleted
|
||||
flash(
|
||||
_('The room "{}" no longer exists in Zoom and was removed from the event').format(vc_room.name),
|
||||
'warning'
|
||||
)
|
||||
# no need to create an association to a room marked as deleted
|
||||
return None
|
||||
# return the new association
|
||||
return super(ZoomPlugin, self).clone_room(old_event_vc_room, link_object)
|
||||
|
||||
def get_blueprints(self):
|
||||
return blueprint
|
||||
|
||||
@ -147,6 +147,11 @@ def update_zoom_meeting(zoom_id, changes, is_webinar=False):
|
||||
except HTTPError as e:
|
||||
from indico_vc_zoom.plugin import ZoomPlugin
|
||||
ZoomPlugin.logger.exception("Error updating meeting '%s': %s", zoom_id, e.response.content)
|
||||
|
||||
if e.response.json()['code'] == 3001:
|
||||
# "Meeting does not exist"
|
||||
raise VCRoomNotFoundError(_("Room no longer exists in Zoom"))
|
||||
|
||||
raise VCRoomError(_("Can't update meeting. Please contact support if the error persists."))
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user