{"action":"created","comment":{"url":"https://api.github.com/repos/edx/edx-platform/pulls/comments/38575936","id":38575936,"diff_hunk":"@@ -19,22 +19,36 @@\n                 '<span class=\"member-count\"><%= membership_message %></span>' +\n                 '<ul class=\"list-member-thumbs\"></ul>'\n             ),\n+            profileImageTemplate: _.template(\n+                '<li class=\"item-member-thumb\"><img alt=\"<%- username %>\" src=\"<%- profile_image_url %>\"></img></li>'\n+            ),\n \n             initialize: function (options) {\n                 this.maxTeamSize = options.maxTeamSize;\n             },\n \n             render: function () {\n-                var memberships = this.model.get('membership'),\n+                var totalMemberships = _(this.model.get('membership'))\n+                        .sortBy(function (member) {return new Date(member.last_activity_at);}).reverse(),\n+                    displayableMemberships = totalMemberships.slice(0, 5),\n                     maxMemberCount = this.maxTeamSize;\n                 this.$el.html(this.template({\n-                    membership_message: TeamUtils.teamCapacityText(memberships.length, maxMemberCount)\n+                    membership_message: TeamUtils.teamCapacityText(totalMemberships.length, maxMemberCount)\n                 }));\n-                _.each(memberships, function (membership) {\n-                    this.$('list-member-thumbs').append(\n-                        '<li class=\"item-member-thumb\"><img alt=\"' + membership.user.username + '\" src=\"\"></img></li>'\n+                _.each(displayableMemberships, function (membership)  {\n+                    this.$('.list-member-thumbs').append(\n+                        this.profileImageTemplate({\n+                            username: membership.user.username,\n+                            profile_image_url: membership.user.profile_image.image_url_small\n+                        })\n                     );\n                 }, this);\n+                if (displayableMemberships.length < totalMemberships.length) {\n+                    this.$('.list-member-thumbs').append(\n+                        '<li class=\"item-member-thumb\"><span class=\"icon fa-ellipsis-h\"></span></li>'","path":"lms/djangoapps/teams/static/teams/js/views/team_card.js","position":35,"original_position":35,"commit_id":"04245bc0cdd744223d7a6f9c32ef1701027888a8","original_commit_id":"04245bc0cdd744223d7a6f9c32ef1701027888a8","user":{"login":"andy-armstrong","id":5985072,"avatar_url":"https://avatars.githubusercontent.com/u/5985072?v=3","gravatar_id":"","url":"https://api.github.com/users/andy-armstrong","html_url":"https://github.com/andy-armstrong","followers_url":"https://api.github.com/users/andy-armstrong/followers","following_url":"https://api.github.com/users/andy-armstrong/following{/other_user}","gists_url":"https://api.github.com/users/andy-armstrong/gists{/gist_id}","starred_url":"https://api.github.com/users/andy-armstrong/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andy-armstrong/subscriptions","organizations_url":"https://api.github.com/users/andy-armstrong/orgs","repos_url":"https://api.github.com/users/andy-armstrong/repos","events_url":"https://api.github.com/users/andy-armstrong/events{/privacy}","received_events_url":"https://api.github.com/users/andy-armstrong/received_events","type":"User","site_admin":false},"body":"This might seem like overkill, but I'd rather have this live in an Underscore template. That way it can be reused in other places. Note that there is no rule that there be a one-to-one correlation between templates and Backbone view, so you wouldn't have to introduce a thumbnail view just for this.","created_at":"2015-09-02T19:51:54Z","updated_at":"2015-09-02T19:51:54Z","html_url":"https://github.com/edx/edx-platform/pull/9546#discussion_r38575936","pull_request_url":"https://api.github.com/repos/edx/edx-platform/pulls/9546","_links":{"self":{"href":"https://api.github.com/repos/edx/edx-platform/pulls/comments/38575936"},"html":{"href":"https://github.com/edx/edx-platform/pull/9546#discussion_r38575936"},"pull_request":{"href":"https://api.github.com/repos/edx/edx-platform/pulls/9546"}}},"pull_request":{"url":"https://api.github.com/repos/edx/edx-platform/pulls/9546","id":43791490,"html_url":"https://github.com/edx/edx-platform/pull/9546","diff_url":"https://github.com/edx/edx-platform/pull/9546.diff","patch_url":"https://github.com/edx/edx-platform/pull/9546.patch","issue_url":"https://api.github.com/repos/edx/edx-platform/issues/9546","number":9546,"state":"open","locked":false,"title":"Add membership thumbnails to team cards","user":{"login":"dan-f","id":2146312,"avatar_url":"https://avatars.githubusercontent.com/u/2146312?v=3","gravatar_id":"","url":"https://api.github.com/users/dan-f","html_url":"https://github.com/dan-f","followers_url":"https://api.github.com/users/dan-f/followers","following_url":"https://api.github.com/users/dan-f/following{/other_user}","gists_url":"https://api.github.com/users/dan-f/gists{/gist_id}","starred_url":"https://api.github.com/users/dan-f/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dan-f/subscriptions","organizations_url":"https://api.github.com/users/dan-f/orgs","repos_url":"https://api.github.com/users/dan-f/repos","events_url":"https://api.github.com/users/dan-f/events{/privacy}","received_events_url":"https://api.github.com/users/dan-f/received_events","type":"User","site_admin":false},"body":"## [TNL-3172](https://openedx.atlassian.net/browse/TNL-3172)\r\n\r\nThis PR adds profile image thumbnails of its members to team cards. They are sorted by last activity date within the team.\r\n\r\n### Sandbox\r\n- [x] https://dan-f.sandbox.edx.org/courses/course-v1:edX+DemoX+Demo_Course/teams/#topics/solar_power\r\n\r\n### Testing\r\n~~- [ ] i18n~~\r\n~~- [ ] RTL~~\r\n~~- [ ] Analytics~~\r\n- [x] Unit, integration, acceptance tests as appropriate\r\n- [x] Performance - covered in work done by @bderusha \r\n\r\n### Reviewers\r\nPlease check the appropriate box after all relevant reviewers have finished and given the :+1:.\r\n- [x] Code review: @dianakhuang \r\n- [ ] Code review: @andy-armstrong \r\n\r\n~~- [ ] UI strings review~~\r\n- [ ] UX review: @frrrances \r\n- [ ] Accessibility review: @cptvitamin \r\n- [ ] Product review: @explorerleslie \r\n- [ ] Documentation review: @catong \r\n\r\n### Post-review\r\n- [ ] Squash commits\r\n","created_at":"2015-08-31T18:04:44Z","updated_at":"2015-09-02T19:51:54Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f59c8f80ecfeaaea075c5557a899baacd3a92dc6","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/edx/edx-platform/pulls/9546/commits","review_comments_url":"https://api.github.com/repos/edx/edx-platform/pulls/9546/comments","review_comment_url":"https://api.github.com/repos/edx/edx-platform/pulls/comments{/number}","comments_url":"https://api.github.com/repos/edx/edx-platform/issues/9546/comments","statuses_url":"https://api.github.com/repos/edx/edx-platform/statuses/04245bc0cdd744223d7a6f9c32ef1701027888a8","head":{"label":"edx:dan-f/add-profile-images-to-team-card","ref":"dan-f/add-profile-images-to-team-card","sha":"04245bc0cdd744223d7a6f9c32ef1701027888a8","user":{"login":"edx","id":3179841,"avatar_url":"https://avatars.githubusercontent.com/u/3179841?v=3","gravatar_id":"","url":"https://api.github.com/users/edx","html_url":"https://github.com/edx","followers_url":"https://api.github.com/users/edx/followers","following_url":"https://api.github.com/users/edx/following{/other_user}","gists_url":"https://api.github.com/users/edx/gists{/gist_id}","starred_url":"https://api.github.com/users/edx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edx/subscriptions","organizations_url":"https://api.github.com/users/edx/orgs","repos_url":"https://api.github.com/users/edx/repos","events_url":"https://api.github.com/users/edx/events{/privacy}","received_events_url":"https://api.github.com/users/edx/received_events","type":"Organization","site_admin":false},"repo":{"id":10391073,"name":"edx-platform","full_name":"edx/edx-platform","owner":{"login":"edx","id":3179841,"avatar_url":"https://avatars.githubusercontent.com/u/3179841?v=3","gravatar_id":"","url":"https://api.github.com/users/edx","html_url":"https://github.com/edx","followers_url":"https://api.github.com/users/edx/followers","following_url":"https://api.github.com/users/edx/following{/other_user}","gists_url":"https://api.github.com/users/edx/gists{/gist_id}","starred_url":"https://api.github.com/users/edx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edx/subscriptions","organizations_url":"https://api.github.com/users/edx/orgs","repos_url":"https://api.github.com/users/edx/repos","events_url":"https://api.github.com/users/edx/events{/privacy}","received_events_url":"https://api.github.com/users/edx/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/edx/edx-platform","description":"The Open edX platform, the software that powers edX!","fork":false,"url":"https://api.github.com/repos/edx/edx-platform","forks_url":"https://api.github.com/repos/edx/edx-platform/forks","keys_url":"https://api.github.com/repos/edx/edx-platform/keys{/key_id}","collaborators_url":"https://api.github.com/repos/edx/edx-platform/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/edx/edx-platform/teams","hooks_url":"https://api.github.com/repos/edx/edx-platform/hooks","issue_events_url":"https://api.github.com/repos/edx/edx-platform/issues/events{/number}","events_url":"https://api.github.com/repos/edx/edx-platform/events","assignees_url":"https://api.github.com/repos/edx/edx-platform/assignees{/user}","branches_url":"https://api.github.com/repos/edx/edx-platform/branches{/branch}","tags_url":"https://api.github.com/repos/edx/edx-platform/tags","blobs_url":"https://api.github.com/repos/edx/edx-platform/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/edx/edx-platform/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/edx/edx-platform/git/refs{/sha}","trees_url":"https://api.github.com/repos/edx/edx-platform/git/trees{/sha}","statuses_url":"https://api.github.com/repos/edx/edx-platform/statuses/{sha}","languages_url":"https://api.github.com/repos/edx/edx-platform/languages","stargazers_url":"https://api.github.com/repos/edx/edx-platform/stargazers","contributors_url":"https://api.github.com/repos/edx/edx-platform/contributors","subscribers_url":"https://api.github.com/repos/edx/edx-platform/subscribers","subscription_url":"https://api.github.com/repos/edx/edx-platform/subscription","commits_url":"https://api.github.com/repos/edx/edx-platform/commits{/sha}","git_commits_url":"https://api.github.com/repos/edx/edx-platform/git/commits{/sha}","comments_url":"https://api.github.com/repos/edx/edx-platform/comments{/number}","issue_comment_url":"https://api.github.com/repos/edx/edx-platform/issues/comments{/number}","contents_url":"https://api.github.com/repos/edx/edx-platform/contents/{+path}","compare_url":"https://api.github.com/repos/edx/edx-platform/compare/{base}...{head}","merges_url":"https://api.github.com/repos/edx/edx-platform/merges","archive_url":"https://api.github.com/repos/edx/edx-platform/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/edx/edx-platform/downloads","issues_url":"https://api.github.com/repos/edx/edx-platform/issues{/number}","pulls_url":"https://api.github.com/repos/edx/edx-platform/pulls{/number}","milestones_url":"https://api.github.com/repos/edx/edx-platform/milestones{/number}","notifications_url":"https://api.github.com/repos/edx/edx-platform/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/edx/edx-platform/labels{/name}","releases_url":"https://api.github.com/repos/edx/edx-platform/releases{/id}","created_at":"2013-05-30T20:20:38Z","updated_at":"2015-09-02T17:14:04Z","pushed_at":"2015-09-02T19:50:44Z","git_url":"git://github.com/edx/edx-platform.git","ssh_url":"git@github.com:edx/edx-platform.git","clone_url":"https://github.com/edx/edx-platform.git","svn_url":"https://github.com/edx/edx-platform","homepage":"http://open.edx.org/","size":2105862,"stargazers_count":2106,"watchers_count":2106,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":1245,"mirror_url":null,"open_issues_count":158,"forks":1245,"open_issues":158,"watchers":2106,"default_branch":"master"}},"base":{"label":"edx:master","ref":"master","sha":"f80720d09ec4d420cc36e235b83d07c6a698ccde","user":{"login":"edx","id":3179841,"avatar_url":"https://avatars.githubusercontent.com/u/3179841?v=3","gravatar_id":"","url":"https://api.github.com/users/edx","html_url":"https://github.com/edx","followers_url":"https://api.github.com/users/edx/followers","following_url":"https://api.github.com/users/edx/following{/other_user}","gists_url":"https://api.github.com/users/edx/gists{/gist_id}","starred_url":"https://api.github.com/users/edx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edx/subscriptions","organizations_url":"https://api.github.com/users/edx/orgs","repos_url":"https://api.github.com/users/edx/repos","events_url":"https://api.github.com/users/edx/events{/privacy}","received_events_url":"https://api.github.com/users/edx/received_events","type":"Organization","site_admin":false},"repo":{"id":10391073,"name":"edx-platform","full_name":"edx/edx-platform","owner":{"login":"edx","id":3179841,"avatar_url":"https://avatars.githubusercontent.com/u/3179841?v=3","gravatar_id":"","url":"https://api.github.com/users/edx","html_url":"https://github.com/edx","followers_url":"https://api.github.com/users/edx/followers","following_url":"https://api.github.com/users/edx/following{/other_user}","gists_url":"https://api.github.com/users/edx/gists{/gist_id}","starred_url":"https://api.github.com/users/edx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edx/subscriptions","organizations_url":"https://api.github.com/users/edx/orgs","repos_url":"https://api.github.com/users/edx/repos","events_url":"https://api.github.com/users/edx/events{/privacy}","received_events_url":"https://api.github.com/users/edx/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/edx/edx-platform","description":"The Open edX platform, the software that powers edX!","fork":false,"url":"https://api.github.com/repos/edx/edx-platform","forks_url":"https://api.github.com/repos/edx/edx-platform/forks","keys_url":"https://api.github.com/repos/edx/edx-platform/keys{/key_id}","collaborators_url":"https://api.github.com/repos/edx/edx-platform/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/edx/edx-platform/teams","hooks_url":"https://api.github.com/repos/edx/edx-platform/hooks","issue_events_url":"https://api.github.com/repos/edx/edx-platform/issues/events{/number}","events_url":"https://api.github.com/repos/edx/edx-platform/events","assignees_url":"https://api.github.com/repos/edx/edx-platform/assignees{/user}","branches_url":"https://api.github.com/repos/edx/edx-platform/branches{/branch}","tags_url":"https://api.github.com/repos/edx/edx-platform/tags","blobs_url":"https://api.github.com/repos/edx/edx-platform/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/edx/edx-platform/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/edx/edx-platform/git/refs{/sha}","trees_url":"https://api.github.com/repos/edx/edx-platform/git/trees{/sha}","statuses_url":"https://api.github.com/repos/edx/edx-platform/statuses/{sha}","languages_url":"https://api.github.com/repos/edx/edx-platform/languages","stargazers_url":"https://api.github.com/repos/edx/edx-platform/stargazers","contributors_url":"https://api.github.com/repos/edx/edx-platform/contributors","subscribers_url":"https://api.github.com/repos/edx/edx-platform/subscribers","subscription_url":"https://api.github.com/repos/edx/edx-platform/subscription","commits_url":"https://api.github.com/repos/edx/edx-platform/commits{/sha}","git_commits_url":"https://api.github.com/repos/edx/edx-platform/git/commits{/sha}","comments_url":"https://api.github.com/repos/edx/edx-platform/comments{/number}","issue_comment_url":"https://api.github.com/repos/edx/edx-platform/issues/comments{/number}","contents_url":"https://api.github.com/repos/edx/edx-platform/contents/{+path}","compare_url":"https://api.github.com/repos/edx/edx-platform/compare/{base}...{head}","merges_url":"https://api.github.com/repos/edx/edx-platform/merges","archive_url":"https://api.github.com/repos/edx/edx-platform/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/edx/edx-platform/downloads","issues_url":"https://api.github.com/repos/edx/edx-platform/issues{/number}","pulls_url":"https://api.github.com/repos/edx/edx-platform/pulls{/number}","milestones_url":"https://api.github.com/repos/edx/edx-platform/milestones{/number}","notifications_url":"https://api.github.com/repos/edx/edx-platform/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/edx/edx-platform/labels{/name}","releases_url":"https://api.github.com/repos/edx/edx-platform/releases{/id}","created_at":"2013-05-30T20:20:38Z","updated_at":"2015-09-02T17:14:04Z","pushed_at":"2015-09-02T19:50:44Z","git_url":"git://github.com/edx/edx-platform.git","ssh_url":"git@github.com:edx/edx-platform.git","clone_url":"https://github.com/edx/edx-platform.git","svn_url":"https://github.com/edx/edx-platform","homepage":"http://open.edx.org/","size":2105862,"stargazers_count":2106,"watchers_count":2106,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":1245,"mirror_url":null,"open_issues_count":158,"forks":1245,"open_issues":158,"watchers":2106,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/edx/edx-platform/pulls/9546"},"html":{"href":"https://github.com/edx/edx-platform/pull/9546"},"issue":{"href":"https://api.github.com/repos/edx/edx-platform/issues/9546"},"comments":{"href":"https://api.github.com/repos/edx/edx-platform/issues/9546/comments"},"review_comments":{"href":"https://api.github.com/repos/edx/edx-platform/pulls/9546/comments"},"review_comment":{"href":"https://api.github.com/repos/edx/edx-platform/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/edx/edx-platform/pulls/9546/commits"},"statuses":{"href":"https://api.github.com/repos/edx/edx-platform/statuses/04245bc0cdd744223d7a6f9c32ef1701027888a8"}}}}