mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 00:46:50 +02:00
Merge branch 'MDL-64038-master' of git://github.com/bmbrands/moodle
This commit is contained in:
commit
13bd9babb4
4 changed files with 10 additions and 4 deletions
|
@ -444,7 +444,9 @@ class api {
|
|||
* @throws \dml_exception
|
||||
*/
|
||||
protected static function get_linked_conversation_extra_fields(array $conversations) : array {
|
||||
global $DB;
|
||||
global $DB, $PAGE;
|
||||
|
||||
$renderer = $PAGE->get_renderer('core');
|
||||
|
||||
$linkedconversations = [];
|
||||
foreach ($conversations as $conversation) {
|
||||
|
@ -476,7 +478,7 @@ class api {
|
|||
$extrafields[$convid]['subname'] = format_string($courseinfo[$groupid]->courseshortname);
|
||||
|
||||
// Imageurl.
|
||||
$extrafields[$convid]['imageurl'] = '';
|
||||
$extrafields[$convid]['imageurl'] = $renderer->image_url('g/g1')->out(false); // default image.
|
||||
if ($url = get_group_picture_url($group, $group->courseid, true)) {
|
||||
$extrafields[$convid]['imageurl'] = $url->out(false);
|
||||
}
|
||||
|
|
|
@ -1686,8 +1686,7 @@ class core_message_api_testcase extends core_message_messagelib_testcase {
|
|||
$conversations = \core_message\api::get_conversations($user3->id);
|
||||
$this->assertEquals(2, $conversations[0]->membercount);
|
||||
$this->assertEquals($course1->shortname, $conversations[0]->subname);
|
||||
$groupimageurl = get_group_picture_url($group2, $group2->courseid, true);
|
||||
$this->assertEquals($groupimageurl, $conversations[0]->imageurl);
|
||||
$this->assertEquals('https://www.example.com/moodle/theme/image.php/_s/boost/core/1/g/g1', $conversations[0]->imageurl);
|
||||
|
||||
// Now, disable the conversation linked to the group and verify it's no longer returned.
|
||||
$DB->set_field('message_conversations', 'enabled', 0, ['id' => $conversations[0]->id]);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue