MDL-65557 forum: increase default image size of author profile url
authorRyan Wyllie <ryan@moodle.com>
Mon, 13 May 2019 08:25:14 +0000 (16:25 +0800)
committerRyan Wyllie <ryan@moodle.com>
Tue, 14 May 2019 00:25:16 +0000 (08:25 +0800)
mod/forum/classes/local/factories/url.php
mod/forum/externallib.php
mod/forum/styles.css
mod/forum/templates/discussion_list.mustache

index f7141b3..6bddd00 100644 (file)
@@ -408,16 +408,21 @@ class url {
      *
      * @param author_entity $author The author
      * @param int|null $authorcontextid The author context id
+     * @param int $size The size of the image to return
      * @return moodle_url
      */
-    public function get_author_profile_image_url(author_entity $author, int $authorcontextid = null) : moodle_url {
+    public function get_author_profile_image_url(
+        author_entity $author,
+        int $authorcontextid = null,
+        int $size = 100
+    ) : moodle_url {
         global $PAGE;
 
         $datamapper = $this->legacydatamapperfactory->get_author_data_mapper();
         $record = $datamapper->to_legacy_object($author);
         $record->contextid = $authorcontextid;
         $userpicture = new user_picture($record);
-        $userpicture->size = 2;
+        $userpicture->size = $size;
 
         return $userpicture->get_url($PAGE);
     }
index 258c8ad..0cab4ad 100644 (file)
@@ -952,12 +952,12 @@ class mod_forum_external extends external_api {
 
                 } else {
                     $discussionobject->userfullname = $firstpostauthor->get_full_name();
-                    $discussionobject->userpictureurl = $urlfactory->get_author_profile_image_url($firstpostauthor)
+                    $discussionobject->userpictureurl = $urlfactory->get_author_profile_image_url($firstpostauthor, null, 2)
                         ->out(false);
 
                     $discussionobject->usermodifiedfullname = $latestpostauthor->get_full_name();
-                    $discussionobject->usermodifiedpictureurl = $urlfactory->get_author_profile_image_url($latestpostauthor)
-                        ->out(false);
+                    $discussionobject->usermodifiedpictureurl = $urlfactory->get_author_profile_image_url(
+                        $latestpostauthor, null, 2)->out(false);
                 }
 
                 $discussions[] = (array) $discussionobject;
index 016023a..d1e59bc 100644 (file)
     margin: 5px 0;
 }
 
+.discussion-list .userpicture {
+    height: 35px;
+    width: 35px;
+}
+
 /** Styles for search.php */
 #page-mod-forum-search .introcontent {
     padding: 15px;
index e37014e..60e3704 100644 (file)
@@ -61,7 +61,7 @@
                 {{#str}} showingcountoftotaldiscussions, mod_forum, {"count": "{{visiblediscussioncount}}", "total":"{{totaldiscussioncount}}"} {{/str}}
             </span>
             <table
-                class="table table-hover table-striped"
+                class="table table-hover table-striped discussion-list"
                 aria-label='{{#str}} showingcountoftotaldiscussions, mod_forum, {"count": "{{visiblediscussioncount}}", "total":"{{totaldiscussioncount}}"} {{/str}}'
                 aria-describedby="discussion-table-description-{{uniqid}}"
             >
                                     <div class="d-flex flex-row">
                                         <div class="align-middle p-0">
                                             <img
-                                                class="h-auto rounded-circle userpicture"
+                                                class="rounded-circle userpicture"
                                                 src="{{urls.profileimage}}"
                                                 alt="{{#str}}pictureof, moodle, {{fullname}}{{/str}}"
                                             >
                                     <div class="d-flex flex-row">
                                         <div class="align-middle p-0">
                                             <a href="{{latestpostauthor.urls.profile}}">
-                                                <img {{!
-                                                    }} class="h-auto rounded-circle userpicture" {{!
-                                                    }} src="{{latestpostauthor.urls.profileimage}}" {{!
-                                                    }} alt="{{#str}}pictureof, moodle, {{latestpostauthor.fullname}}{{/str}}" {{!
-                                                    }}>
+                                                <img
+                                                    class="rounded-circle userpicture"
+                                                    src="{{latestpostauthor.urls.profileimage}}"
+                                                    alt="{{#str}}pictureof, moodle, {{latestpostauthor.fullname}}{{/str}}"
+                                                >
                                             </a>
                                         </div>
                                         <div class="p-2 p-t-0 p-b-0 d-inline-flex flex-column">