mirror of
https://github.com/moodle/moodle.git
synced 2025-08-06 17:36:38 +02:00
Merge branch 'MDL-65608-master' of https://github.com/ryanwyllie/moodle
This commit is contained in:
commit
1cc57c5d10
1 changed files with 24 additions and 16 deletions
|
@ -166,25 +166,33 @@ class discussion extends exporter {
|
|||
$discussion = $this->discussion;
|
||||
|
||||
$groupdata = null;
|
||||
if ($discussion->has_group() && $group = $this->related['groupsbyid'][$discussion->get_group_id()]) {
|
||||
if ($discussion->has_group()) {
|
||||
$groupsbyid = $this->related['groupsbyid'];
|
||||
$group = $groupsbyid[$discussion->get_group_id()] ?? null;
|
||||
|
||||
// We may not have received the group if the caller doesn't want to include it in the export
|
||||
// or if it's been deleted and the discussion record hasn't been updated.
|
||||
if ($group) {
|
||||
$groupdata = [
|
||||
'name' => $group->name,
|
||||
'urls' => [],
|
||||
];
|
||||
$canviewparticipants = $capabilitymanager->can_view_participants($user, $discussion);
|
||||
|
||||
if (!$group->hidepicture) {
|
||||
$url = get_group_picture_url($group, $forum->get_course_id());
|
||||
if (!empty($url)) {
|
||||
$groupdata['urls']['picture'] = $url;
|
||||
}
|
||||
}
|
||||
if ($canviewparticipants) {
|
||||
|
||||
if ($capabilitymanager->can_view_participants($user, $discussion)) {
|
||||
$groupdata['urls']['userlist'] = (new \moodle_url('/user/index.php', [
|
||||
'id' => $forum->get_course_id(),
|
||||
'group' => $group->id,
|
||||
]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$viewfirstunreadurl = $urlfactory->get_discussion_view_first_unread_post_url_from_discussion($discussion);
|
||||
$data = [
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue