MDL-78172 mod_forum: ensure group names are correctly formatted.

This commit is contained in:
Paul Holden 2023-05-09 09:37:27 +01:00
parent 76fe404dd5
commit 9ed9a010d6
No known key found for this signature in database
GPG Key ID: A81A96D6045F6164
4 changed files with 6 additions and 6 deletions

View File

@ -172,7 +172,7 @@ class author extends exporter {
return [
'id' => $group->id,
'name' => $group->name,
'name' => format_string($group->name, true, ['context' => $context]),
'urls' => [
'image' => $imageurl ? $imageurl->out(false) : null,
'group' => $groupurl ? $groupurl->out(false) : null

View File

@ -174,7 +174,7 @@ class discussion extends exporter {
// or if it's been deleted and the discussion record hasn't been updated.
if ($group) {
$groupdata = [
'name' => $group->name,
'name' => format_string($group->name, true, ['context' => $this->related['context']]),
'urls' => [],
];

View File

@ -174,7 +174,7 @@ class mod_forum_post_form extends moodleform {
// We must make this check because all groups are returned for a visible grouped activity.
if (forum_user_can_post_discussion($forum, $groupid, null, $cm, $modcontext)) {
// Build the data for the groupinfo select.
$groupinfo[$groupid] = $group->name;
$groupinfo[$groupid] = format_string($group->name, true, ['context' => $modcontext]);
} else {
unset($groupdata[$groupid]);
}

View File

@ -24,6 +24,7 @@
namespace forumreport_summary\output;
use context_course;
use moodle_url;
use renderable;
use renderer_base;
@ -31,8 +32,6 @@ use stdClass;
use templatable;
use forumreport_summary;
defined('MOODLE_INTERNAL') || die();
/**
* Forum summary report filters renderable.
*
@ -186,8 +185,9 @@ class filters implements renderable, templatable {
$allowedgroupsobj = $usergroups;
}
$contextcourse = context_course::instance($this->courseid);
foreach ($allowedgroupsobj as $group) {
$groupsavailable[$group->id] = $group->name;
$groupsavailable[$group->id] = format_string($group->name, true, ['context' => $contextcourse]);
}
// Set valid groups selected.