diff --git a/vc_zoom/README.md b/vc_zoom/README.md index d20527c..f819585 100644 --- a/vc_zoom/README.md +++ b/vc_zoom/README.md @@ -27,6 +27,7 @@ - Do not allow passcodes that are too long for zoom - 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) **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. diff --git a/vc_zoom/indico_vc_zoom/plugin.py b/vc_zoom/indico_vc_zoom/plugin.py index d641660..46ff64e 100644 --- a/vc_zoom/indico_vc_zoom/plugin.py +++ b/vc_zoom/indico_vc_zoom/plugin.py @@ -148,6 +148,7 @@ class ZoomPlugin(VCPluginMixin, IndicoPlugin): super().init() self.connect(signals.plugin.cli, self._extend_indico_cli) self.connect(signals.event.times_changed, self._times_changed) + self.connect(signals.event.metadata_postprocess, self._event_metadata_postprocess) self.template_hook('event-vc-room-list-item-labels', self._render_vc_room_labels) self.inject_bundle('main.js', WPSimpleEventDisplay) self.inject_bundle('main.js', WPVCEventPage) @@ -218,13 +219,24 @@ class ZoomPlugin(VCPluginMixin, IndicoPlugin): }) elif room_assoc.link_object != old_link: # the booking should now be linked to something else - new_schedule_args = get_schedule_args(room_assoc.link_object) + new_schedule_args = get_schedule_args(room_assoc.link_object) if room_assoc.link_object.start_dt else {} meeting = fetch_zoom_meeting(vc_room) current_schedule_args = {k: meeting[k] for k in {'start_time', 'duration'} if k in meeting} # check whether the start time / duration of the scheduled meeting differs if new_schedule_args != current_schedule_args: - update_zoom_meeting(vc_room.data['zoom_id'], new_schedule_args) + if new_schedule_args: + update_zoom_meeting(vc_room.data['zoom_id'], new_schedule_args) + else: + 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 + ) + }) room_assoc.data['password_visibility'] = data.pop('password_visibility') flag_modified(room_assoc, 'data') @@ -497,3 +509,24 @@ class ZoomPlugin(VCPluginMixin, IndicoPlugin): return flash(message, 'warning') + + def _event_metadata_postprocess(self, sender, event, data, user=None, **kwargs): + urls = [] + for assoc in event.vc_room_associations: + if not assoc.show or assoc.vc_room.type != 'zoom': + continue + visibility = assoc.data.get('password_visibility', 'logged_in') + if ( + visibility == 'everyone' or + (visibility == 'logged_in' and user is not None) or + (visibility == 'registered' and user is not None and event.is_user_registered(user)) or + event.can_manage(user) + ): + urls.append('{}: {}'.format(assoc.vc_room.name, assoc.vc_room.data['url'])) + elif visibility == 'no_one': + # XXX: Not sure if showing this is useful, but on the event page we show the join link + # with no passcode as well, so let's the logic identical here. + urls.append('{}: {}'.format(assoc.vc_room.name, assoc.vc_room.data['public_url'])) + + if urls: + return {'description': (data['description'] + '\n\n' + '\n'.join(urls)).strip()} diff --git a/vc_zoom/indico_vc_zoom/translations/messages.pot b/vc_zoom/indico_vc_zoom/translations/messages.pot index 2eff619..13bb658 100644 --- a/vc_zoom/indico_vc_zoom/translations/messages.pot +++ b/vc_zoom/indico_vc_zoom/translations/messages.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PROJECT VERSION\n" "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" -"POT-Creation-Date: 2021-01-05 13:20+0100\n" +"POT-Creation-Date: 2021-01-11 10:36+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -270,32 +270,36 @@ msgid "" "session block which were not automatically updated." msgstr "" -#: indico_vc_zoom/util.py:42 +#: indico_vc_zoom/util.py:45 msgid "All emails" msgstr "" -#: indico_vc_zoom/util.py:43 +#: indico_vc_zoom/util.py:46 msgid "Email domains" msgstr "" -#: indico_vc_zoom/util.py:44 +#: indico_vc_zoom/util.py:47 msgid "Authenticators" msgstr "" -#: indico_vc_zoom/util.py:124 +#: indico_vc_zoom/util.py:127 msgid "This room has been deleted from Zoom" msgstr "" -#: indico_vc_zoom/util.py:128 +#: indico_vc_zoom/util.py:131 msgid "" "Problem fetching room from Zoom. Please contact support if the error " "persists." msgstr "" -#: indico_vc_zoom/util.py:147 +#: indico_vc_zoom/util.py:150 msgid "Can't update meeting. Please contact support if the error persists." msgstr "" +#: indico_vc_zoom/util.py:206 +msgid "Could not find Zoom user for alternative host" +msgstr "" + #: indico_vc_zoom/templates/buttons.html:9 msgid "You will become an alternative host of this Zoom meeting" msgstr "" diff --git a/vc_zoom/indico_vc_zoom/util.py b/vc_zoom/indico_vc_zoom/util.py index 999629f..08e8bb7 100644 --- a/vc_zoom/indico_vc_zoom/util.py +++ b/vc_zoom/indico_vc_zoom/util.py @@ -199,4 +199,7 @@ def process_alternative_hosts(emails): def get_alt_host_emails(identifiers): """Convert a list of identities into a list of enterprise e-mails.""" - return [find_enterprise_email(principal_from_identifier(ident)) for ident in identifiers] + emails = [find_enterprise_email(principal_from_identifier(ident)) for ident in identifiers] + if None in emails: + raise VCRoomError(_('Could not find Zoom user for alternative host')) + return emails