Skip to content

ical Notifications: Fix users to notify - #708

Merged
smbader merged 1 commit into
jrchamp:mainfrom
OpenCollabZA:fix/ical_users_to_notify
Apr 16, 2026
Merged

ical Notifications: Fix users to notify#708
smbader merged 1 commit into
jrchamp:mainfrom
OpenCollabZA:fix/ical_users_to_notify

Conversation

@paulandm

@paulandm paulandm commented Apr 8, 2026

Copy link
Copy Markdown
Contributor

Send ical notifications task: Fix users to notify.

Previously we made use of the 'get_users_by_capability', but we noticed that is not sufficient.

We copied a course that contained a zoom activity scheduled for a future time.
The copied course doesn't contain any user enrolments (we selected that option).
But then the ical notifications would still be sent to users with high-level capabilities in the copied course's zoom activity. This is incorrect since it should only be sent to users enrolled within the course.

@jrchamp jrchamp left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @paulandm ! This looks great to me! I added a comment to detail my technical understanding of the change in case it is helpful to other reviewers.

private function get_users_to_notify(int $zoomid, int $courseid) {
$cminfo = get_fast_modinfo($courseid)->instances['zoom'][$zoomid];
$users = get_users_by_capability($cminfo->context, 'mod/zoom:view');
$users = get_enrolled_users($cminfo->context, 'mod/zoom:view', 0, 'u.*', null, 0, 0, true);

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In review: get_users_by_capability($context, $capability) and get_enrolled_users($context, $capability) only differ in that the latter also requires an enrollment in the course. The next four parameters have been set to the default. Only the final parameter is not default, setting $active to true, which excludes suspended and expired enrollments. The change overall thus requires active enrollments, which aligns with Moodle's stance that only active course participants should be notified about activity events (like forum posts).

@smbader

smbader commented Apr 9, 2026

Copy link
Copy Markdown
Collaborator

Hello Paul!

This is a great contribution! The change looks good as well - we are going to do some quick testing and get this approved soon.

Thank you so much!
Steve

@smbader
smbader requested a review from sgrandh3 April 9, 2026 15:14
@smbader smbader added the bug Fixes problems or reduces technical debt label Apr 9, 2026
@smbader smbader moved this to Has Pull Request in mod_zoom Workflow Apr 9, 2026
@smbader
smbader merged commit 5d33d5b into jrchamp:main Apr 16, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Fixes problems or reduces technical debt

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants