From 166d1374073029a1bac6a8760981574cbd25041e Mon Sep 17 00:00:00 2001 From: Andrew Nicols Date: Wed, 4 Oct 2023 13:03:22 +0800 Subject: [PATCH] MDL-79581 communication_matrix: Use the contextid from the API --- .../provider/matrix/classes/communication_feature.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/communication/provider/matrix/classes/communication_feature.php b/communication/provider/matrix/classes/communication_feature.php index f0bec8b8c0f..1f377f7b6ce 100644 --- a/communication/provider/matrix/classes/communication_feature.php +++ b/communication/provider/matrix/classes/communication_feature.php @@ -737,10 +737,9 @@ class communication_feature implements * @return int */ public function get_user_allowed_power_level(int $userid): int { - $context = \core\context\course::instance($this->processor->get_instance_id()); $powerlevel = matrix_constants::POWER_LEVEL_DEFAULT; - if (has_capability('communication/matrix:moderator', $context, $userid)) { + if (has_capability('communication/matrix:moderator', $this->processor->get_context(), $userid)) { $powerlevel = matrix_constants::POWER_LEVEL_MOODLE_MODERATOR; }