MDL-72325 user: Use the core_user::awaiting_action() in existing places

There were existing places each doing its own checks similar to the ones
covered by the newly added core_user::awaiting_action() method. This
patch replaces those custom checks with this new API call.
This commit is contained in:
David Mudrák 2021-08-12 12:44:52 +02:00
parent 124b82831b
commit f9ee118e94
3 changed files with 3 additions and 10 deletions

View File

@ -551,10 +551,7 @@ class helper {
global $USER, $CFG, $PAGE;
// Early bail out conditions.
if (empty($CFG->messaging) || !isloggedin() || isguestuser() || user_not_fully_set_up($USER) ||
get_user_preferences('auth_forcepasswordchange') ||
(!$USER->policyagreed && !is_siteadmin() &&
($manager = new \core_privacy\local\sitepolicy\manager()) && $manager->is_defined())) {
if (empty($CFG->messaging) || !isloggedin() || isguestuser() || \core_user::awaiting_action()) {
return '';
}

View File

@ -34,10 +34,7 @@ function message_popup_render_navbar_output(\renderer_base $renderer) {
global $USER, $CFG;
// Early bail out conditions.
if (!isloggedin() || isguestuser() || user_not_fully_set_up($USER) ||
get_user_preferences('auth_forcepasswordchange') ||
(!$USER->policyagreed && !is_siteadmin() &&
($manager = new \core_privacy\local\sitepolicy\manager()) && $manager->is_defined())) {
if (!isloggedin() || isguestuser() || \core_user::awaiting_action()) {
return '';
}

View File

@ -72,8 +72,7 @@ class user_profile_set extends \core_analytics\local\indicator\linear {
// Nothing set results in -1.
$calculatedvalue = self::MIN_VALUE;
$sitepolicymanager = new \core_privacy\local\sitepolicy\manager();
if ($sitepolicymanager->is_defined() && !$user->policyagreed) {
if (\core_user::awaiting_action($user)) {
return self::MIN_VALUE;
}