Skip to content

Commit

Permalink
MDL-64229 core_message: ensure profile pic links to profile
Browse files Browse the repository at this point in the history
  • Loading branch information
mdjnelson committed Dec 13, 2018
1 parent 11d0c68 commit fd12e12
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 9 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Expand Up @@ -87,6 +87,7 @@ define(['jquery'], function($) {
return {
id: member.id,
fullname: member.fullname,
profileurl: member.profileurl,
profileimageurl: member.profileimageurl,
profileimageurlsmall: member.profileimageurlsmall,
isonline: member.isonline,
Expand Down
4 changes: 4 additions & 0 deletions message/classes/helper.php
Expand Up @@ -524,6 +524,10 @@ public static function get_member_info(int $referenceuserid, array $userids, boo
$data->id = $member->id;
$data->fullname = fullname($member);

// Create the URL for their profile.
$profileurl = new \moodle_url('/user/profile.php', ['id' => $member->id]);
$data->profileurl = $profileurl->out(false);

// Set the user picture data.
$userpicture = new \user_picture($member);
$userpicture->size = 1; // Size f1.
Expand Down
1 change: 1 addition & 0 deletions message/externallib.php
Expand Up @@ -1147,6 +1147,7 @@ private static function get_conversation_member_structure() {
$result = [
'id' => new external_value(PARAM_INT, 'The user id'),
'fullname' => new external_value(PARAM_NOTAGS, 'The user\'s name'),
'profileurl' => new external_value(PARAM_URL, 'The link to the user\'s profile page'),
'profileimageurl' => new external_value(PARAM_URL, 'User picture URL'),
'profileimageurlsmall' => new external_value(PARAM_URL, 'Small user picture URL'),
'isonline' => new external_value(PARAM_BOOL, 'The user\'s online status'),
Expand Down
Expand Up @@ -40,14 +40,16 @@
</a>
<div class="px-3 pb-3">
<div class="text-center">
<img
class="rounded-circle"
src="{{profileimageurl}}"
aria-hidden="true"
alt="{{#str}} pictureof, moodle, {{fullname}} {{/str}}"
title="{{#str}} pictureof, moodle, {{fullname}} {{/str}}"
style="height: 100px; width: 100px"
>
<a href="{{{profileurl}}}">
<img
class="rounded-circle"
src="{{profileimageurl}}"
aria-hidden="true"
alt="{{#str}} pictureof, moodle, {{fullname}} {{/str}}"
title="{{#str}} pictureof, moodle, {{fullname}} {{/str}}"
style="height: 100px; width: 100px"
>
</a>
</div>
<h2 class="mt-2 text-center text-truncate">{{fullname}}</h2>
<div class="px-4 mt-4">
Expand Down

0 comments on commit fd12e12

Please sign in to comment.