MDL-65888 forum: Do not send notifications to unconfirmed users
commit1ecf0397bbb9929c2c27824df7ee96b9bc128578
authorDavid Mudrák <david@moodle.com>
Tue, 11 Jun 2019 07:45:21 +0000 (11 09:45 +0200)
committerDavid Mudrák <david@moodle.com>
Tue, 11 Jun 2019 07:53:23 +0000 (11 09:53 +0200)
tree80f836e7f4e1cfc12070c7a1317c7ef3aa17cb77
parentf3507273e9f5eb05bb05c24f390d2fc8bf2dcf0a
MDL-65888 forum: Do not send notifications to unconfirmed users

Under certain conditions, users marked as not confirmed yet may be
returned as forum notification recipients. Such users are considered as
inactive though and the delivery adhoc task cannot be run as these
users, throwing an exception.

The solution is to make sure that fetch_subscribed_users() does not
include unconfirmed users, similarly to what was done for suspended
users and nologin users.

The added unit test also checks for deleted users. But these should
never be returned as subscribed because we consider enrolled users only
and deleted users are filtered out implicitly.
mod/forum/classes/subscriptions.php
mod/forum/tests/mail_test.php