-
Notifications
You must be signed in to change notification settings - Fork 108
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Send ical Notifications (Version 2) #623
base: main
Are you sure you want to change the base?
Send ical Notifications (Version 2) #623
Conversation
Add initial send ical notification changes.
Corrected Moodle styling errors.
Corrected function documentation.
Remove registration validation feature from this branch
Revert file to original state
Code cleanup of send_ical_notifications task
Base ical notifications task on zoom event ids
Move the ical invite buffer back to 10 minutes
Fix Moodle Code and PHPDoc Checker errors
Fix Moodle Code Checker warning
Add missing messageprovider string
Moodle 3.9 compatibility: Removed 'MESSAGE_DEFAULT_ENABLED' constant
Moodle 3.9 compatibility fixes.
This reverts commit c99249a.
Move ical notifications table to new savepoint block
Update version number to match upgrade save point Fix descriptions of zoom_ical_notifications table in the install file.
Updated from main, adjusted version number
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @paulandm! Thank you for all your work on this. I had a few ideas that took a while to collect. I may have missed some things, so apologies if I have more comments later on items that were already present in this version of the code.
if ($zoom->registration == ZOOM_REGISTRATION_OFF) { | ||
$icalevent->add_property('location', $zoom->join_url); | ||
} else { | ||
$registrantjoinurl = zoom_get_registrant_join_url($user->email, $zoom->meeting_id, $zoom->webinar); | ||
if ($registrantjoinurl) { | ||
$icalevent->add_property('location', $registrantjoinurl); | ||
} else { | ||
$icalevent->add_property('location', $zoom->join_url); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of providing the stored join_url, it's probably better to send the user to the Moodle site's join URL. That way they won't circumvent the authentication/logging mechanisms or be left with an outdated/cached version of the URL.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jrchamp Would it be a good idea if we maybe add a feature to the mod/zoom/view.php page to include a optional parameter like 'autojoin', so that the authenticated user is automatically forwarded to the zoom url?
Implement PR feedback
Implemented the PR feedback. |
Implemented PR feedback
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @paulandm! We'll take a closer look at this updated version during our next meeting. There are a few comments from last time, like the MySQL-specific SQL that will need to be addressed before it can be merged, but I'm excited to see the progress.
@@ -184,5 +184,17 @@ | |||
<KEY NAME="fk_breakoutroomid" TYPE="foreign" FIELDS="breakoutroomid" REFTABLE="zoom_meeting_breakout_rooms" REFFIELDS="id"/> | |||
</KEYS> | |||
</TABLE> | |||
<TABLE NAME="zoom_ical_notifications" COMMENT="Identifies the zoom event for which ical notifications have been emailed."> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note to self: Generate this using XMLDB and export it using XMLDB. Check for differences.
Implemented PR Feedback related to DB
Thanks @jrchamp I've implemented some improvements related to DB compatibility and have simplified the keys of the table. |
$messagedata->subject = $zoomevent->name; | ||
$messagedata->fullmessage = $zoomevent->description; | ||
$messagedata->fullmessageformat = FORMAT_HTML; | ||
$messagedata->fullmessagehtml = $zoomevent->description; | ||
$messagedata->smallmessage = $zoomevent->name . ' - ' . $zoomevent->description; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note to tester: Do we need to apply filters like in #615 so the messages reflect the displayed values for the activities? Do the event names and descriptions already have the post-processed value or do they need to have the filter applied? There is a helper function for the activity name, but testing would be needed to determine if the description gets automatically passed through filters or not or if we need to supply the context.
$messagedata = new \core\message\message(); | ||
$messagedata->component = 'mod_zoom'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note to reviewer: Compare to core Moodle to see if this is the recommended pattern for initializing the object.
'contextid' => \context_user::instance($user->id)->id, | ||
'component' => 'user', | ||
'filearea' => 'draft', | ||
'itemid' => file_get_unused_draft_itemid(), | ||
'filepath' => '/', | ||
'filename' => clean_filename('icalexport.ics'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewer: Determine if these is a concern about unique filenames. Do/should these files get cleaned up after use?
// Check if user has "Disable notifications" set. | ||
if ($user->emailstop) { | ||
continue; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewer: Is emailstop intended to stop all messages or only emails? Are we supposed to be doing this check, or is this supposed to be handled by the messaging system itself?
* @param string $zoomeventid The zoom event id. | ||
*/ | ||
private function set_notification_executiontime(string $zoomeventid) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewer: I would fully expect this to be an integer. Maybe it depends on the database and PHP versions, but that would mean this will break on some systems. Probably best to cast as (int)
before passing to this function and update the parameter types.
* @param string $zoomeventid The zoom event id. | ||
* @return string The timestamp of the last execution. | ||
*/ | ||
private function get_notification_executiontime(string $zoomeventid) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewer: Same concern about parameter types (should probably cast to `(int)``)
A refactored / cleaned up version of the original PR for the Send ical notifications task.
The notifications are now based on the zoom event record (instead of the zoom record).
Was able to incorporate the 'zoom_helper_icalendar_event' function in the creation of the ical event.
The buffer of 10 minutes before sending out invites remain in place. The idea is still that an ical invite should only be sent once per Zoom event. Since we don't have access to the participants' calendars, we can't actually update already sent ical invites. So if we change the code to send ical invites for a Zoom activity edit action (after the 10 minute buffer period), it will send an additional ical invite instead of actually changing the previous one sent. This might be appropriate behavior for some, but it is not applicable in our use case. @jrchamp I'm happy to discuss some ideas around this 'update' scenario further if required.
The buffer period of 10 minutes could also potentially move out to a setting if preferred?