{"action":"created","comment":{"url":"https://api.github.com/repos/edx/edx-app-android/pulls/comments/70826437","id":70826437,"diff_hunk":"@@ -1,16 +1,110 @@\n package org.edx.mobile.view.view_holders;\n \n+import android.content.Context;\n+import android.support.annotation.NonNull;\n+import android.support.annotation.Nullable;\n+import android.support.v4.widget.TextViewCompat;\n import android.view.View;\n+import android.view.ViewGroup;\n+import android.widget.ImageView;\n import android.widget.TextView;\n \n+import com.bumptech.glide.Glide;\n+import com.google.inject.Inject;\n+import com.joanzapata.iconify.IconDrawable;\n+import com.joanzapata.iconify.fonts.FontAwesomeIcons;\n+\n import org.edx.mobile.R;\n+import org.edx.mobile.discussion.DiscussionTextUtils;\n+import org.edx.mobile.discussion.IAuthorData;\n+import org.edx.mobile.model.api.ProfileModel;\n+import org.edx.mobile.module.prefs.UserPrefs;\n+import org.edx.mobile.user.ProfileImage;\n+import org.edx.mobile.util.Config;\n+\n+import roboguice.RoboGuice;\n \n public class AuthorLayoutViewHolder {\n \n-    public final TextView discussionAuthorTextView;\n+    public interface ProfileImageProvider {\n+        @Nullable\n+        ProfileImage getProfileImage();\n+    }\n+\n+    @Inject\n+    UserPrefs userPrefs;\n+\n+    public final ViewGroup profileRow;\n+    public final ImageView profileImageView;\n+    public final TextView authorTextView;\n+    public final TextView dateTextView;\n+    public final TextView answerTextView;\n \n     public AuthorLayoutViewHolder(View itemView) {\n-        discussionAuthorTextView = (TextView) itemView.\n-                findViewById(R.id.discussion_author_layout_author_text_view);\n+        profileRow = (ViewGroup) itemView;\n+        profileImageView = (ImageView) itemView.findViewById(R.id.profile_image);\n+        authorTextView = (TextView) itemView.findViewById(R.id.discussion_author_text_view);\n+        dateTextView = (TextView) itemView.findViewById(R.id.discussion_date_text_view);\n+        answerTextView = (TextView) itemView.findViewById(R.id.discussion_responses_answer_text_view);\n+\n+        final Context context = answerTextView.getContext();\n+        TextViewCompat.setCompoundDrawablesRelativeWithIntrinsicBounds(\n+                answerTextView,\n+                new IconDrawable(context, FontAwesomeIcons.fa_check_square_o)\n+                        .sizeRes(context, R.dimen.edx_xxx_small)\n+                        .colorRes(context, R.color.edx_utility_success),\n+                null, null, null);\n+        RoboGuice.getInjector(context).injectMembers(this);\n+    }\n+\n+    public void populateViewHolder(@NonNull Config config, @NonNull IAuthorData authorData,\n+                                   @NonNull ProfileImageProvider provider,\n+                                   long initialTimeStampMs,\n+                                   @NonNull final Runnable listener) {","path":"VideoLocker/src/main/java/org/edx/mobile/view/view_holders/AuthorLayoutViewHolder.java","position":66,"original_position":66,"commit_id":"b8715ba15340e173662fac2dd8f5238d0b72e128","original_commit_id":"2dac7cef16f864914c5dca5c6c99dadaf1cc8933","user":{"login":"miankhalid","id":1710804,"avatar_url":"https://avatars.githubusercontent.com/u/1710804?v=3","gravatar_id":"","url":"https://api.github.com/users/miankhalid","html_url":"https://github.com/miankhalid","followers_url":"https://api.github.com/users/miankhalid/followers","following_url":"https://api.github.com/users/miankhalid/following{/other_user}","gists_url":"https://api.github.com/users/miankhalid/gists{/gist_id}","starred_url":"https://api.github.com/users/miankhalid/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/miankhalid/subscriptions","organizations_url":"https://api.github.com/users/miankhalid/orgs","repos_url":"https://api.github.com/users/miankhalid/repos","events_url":"https://api.github.com/users/miankhalid/events{/privacy}","received_events_url":"https://api.github.com/users/miankhalid/received_events","type":"User","site_admin":false},"body":"Good point 😉 ","created_at":"2016-07-14T15:26:51Z","updated_at":"2016-07-14T15:26:51Z","html_url":"https://github.com/edx/edx-app-android/pull/752#discussion_r70826437","pull_request_url":"https://api.github.com/repos/edx/edx-app-android/pulls/752","_links":{"self":{"href":"https://api.github.com/repos/edx/edx-app-android/pulls/comments/70826437"},"html":{"href":"https://github.com/edx/edx-app-android/pull/752#discussion_r70826437"},"pull_request":{"href":"https://api.github.com/repos/edx/edx-app-android/pulls/752"}}},"pull_request":{"url":"https://api.github.com/repos/edx/edx-app-android/pulls/752","id":74930921,"html_url":"https://github.com/edx/edx-app-android/pull/752","diff_url":"https://github.com/edx/edx-app-android/pull/752.diff","patch_url":"https://github.com/edx/edx-app-android/pull/752.patch","issue_url":"https://api.github.com/repos/edx/edx-app-android/issues/752","number":752,"state":"open","locked":false,"title":"Profile Pictures in Forums","user":{"login":"miankhalid","id":1710804,"avatar_url":"https://avatars.githubusercontent.com/u/1710804?v=3","gravatar_id":"","url":"https://api.github.com/users/miankhalid","html_url":"https://github.com/miankhalid","followers_url":"https://api.github.com/users/miankhalid/followers","following_url":"https://api.github.com/users/miankhalid/following{/other_user}","gists_url":"https://api.github.com/users/miankhalid/gists{/gist_id}","starred_url":"https://api.github.com/users/miankhalid/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/miankhalid/subscriptions","organizations_url":"https://api.github.com/users/miankhalid/orgs","repos_url":"https://api.github.com/users/miankhalid/repos","events_url":"https://api.github.com/users/miankhalid/events{/privacy}","received_events_url":"https://api.github.com/users/miankhalid/received_events","type":"User","site_admin":false},"body":"### [MA-1486](https://openedx.atlassian.net/browse/MA-1486)\r\n\r\n- 'requested_fields' query param added to GET APIs for responses and\r\ncomments, which gives us back a \"users\" dictionary containing a user's\r\nprofile info.\r\n- Author attribution for POST types changed, since we have now separated\r\nthe author name + label from the a post's creation date.\r\n- A separate layout has been created for profile pic and an author's\r\ndetail by the name **discussion_user_profile_row** which contains all\r\nrelated views. A dedicated `ViewHolder` class **AuthorLayoutViewHolder**\r\nmanages the manipulation of views within the layout.\r\n- Tests updated accordingly.\r\n\r\n### Notes\r\n\r\n1. This PR can only be tested on the [Lahore Sandbox](https://lahore.sandbox.edx.org) currently, as its the only one that returns profile images in response.\r\n\r\n2. *Commit - a5fd696 specifically handles the following cases:*\r\n\r\n  1. Currently the POST & PUT APIs aren't configured to return a user's profile image in their response. Since, the currently logged-in user is the only one that can POST using the app, so, we use the locally stored profile image in preferences as a fallback.\r\n\r\n  2. Incase of PATCH we just revert to the Xsie dummy image, since we've lost the user's picture after PATCH returns.\r\n\r\n**There is currently an open ticket on this matter i.e. [MA-2542](https://openedx.atlassian.net/browse/MA-2542)**\r\n\r\n### Screenshots\r\n\r\nResponses | Add Response | Comments | Add Comment\r\n---- | ---- | ---- | ----\r\n![responses](https://cloud.githubusercontent.com/assets/1710804/16411440/7eccdd58-3d40-11e6-8358-ec12327da211.png) | ![add_response](https://cloud.githubusercontent.com/assets/1710804/16411453/85714b62-3d40-11e6-85c6-bbe266a6e80c.png) | ![comments](https://cloud.githubusercontent.com/assets/1710804/16411456/88ca89ea-3d40-11e6-9681-b0c386321069.png) | ![add_comment](https://cloud.githubusercontent.com/assets/1710804/16411458/8b754e00-3d40-11e6-8eed-9214524c232c.png)\r\n\r\n\r\n### Reviewers\r\nIf you've been tagged for review, please check your corresponding box once you've given the :+1:.\r\n- [x] Code review: @1zaman \r\n- [ ] Code review: @BenjiLee \r\n- [ ] Code review: @bguertin  \r\n- [x] Code review: @mdinino ","created_at":"2016-06-23T10:27:34Z","updated_at":"2016-07-14T15:26:52Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9b72da613dee37edab0b5e4a1807be1d85e505a4","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/edx/edx-app-android/pulls/752/commits","review_comments_url":"https://api.github.com/repos/edx/edx-app-android/pulls/752/comments","review_comment_url":"https://api.github.com/repos/edx/edx-app-android/pulls/comments{/number}","comments_url":"https://api.github.com/repos/edx/edx-app-android/issues/752/comments","statuses_url":"https://api.github.com/repos/edx/edx-app-android/statuses/b8715ba15340e173662fac2dd8f5238d0b72e128","head":{"label":"edx:khalid/MA-1486","ref":"khalid/MA-1486","sha":"b8715ba15340e173662fac2dd8f5238d0b72e128","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":29251742,"name":"edx-app-android","full_name":"edx/edx-app-android","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-app-android","description":"","fork":false,"url":"https://api.github.com/repos/edx/edx-app-android","forks_url":"https://api.github.com/repos/edx/edx-app-android/forks","keys_url":"https://api.github.com/repos/edx/edx-app-android/keys{/key_id}","collaborators_url":"https://api.github.com/repos/edx/edx-app-android/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/edx/edx-app-android/teams","hooks_url":"https://api.github.com/repos/edx/edx-app-android/hooks","issue_events_url":"https://api.github.com/repos/edx/edx-app-android/issues/events{/number}","events_url":"https://api.github.com/repos/edx/edx-app-android/events","assignees_url":"https://api.github.com/repos/edx/edx-app-android/assignees{/user}","branches_url":"https://api.github.com/repos/edx/edx-app-android/branches{/branch}","tags_url":"https://api.github.com/repos/edx/edx-app-android/tags","blobs_url":"https://api.github.com/repos/edx/edx-app-android/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/edx/edx-app-android/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/edx/edx-app-android/git/refs{/sha}","trees_url":"https://api.github.com/repos/edx/edx-app-android/git/trees{/sha}","statuses_url":"https://api.github.com/repos/edx/edx-app-android/statuses/{sha}","languages_url":"https://api.github.com/repos/edx/edx-app-android/languages","stargazers_url":"https://api.github.com/repos/edx/edx-app-android/stargazers","contributors_url":"https://api.github.com/repos/edx/edx-app-android/contributors","subscribers_url":"https://api.github.com/repos/edx/edx-app-android/subscribers","subscription_url":"https://api.github.com/repos/edx/edx-app-android/subscription","commits_url":"https://api.github.com/repos/edx/edx-app-android/commits{/sha}","git_commits_url":"https://api.github.com/repos/edx/edx-app-android/git/commits{/sha}","comments_url":"https://api.github.com/repos/edx/edx-app-android/comments{/number}","issue_comment_url":"https://api.github.com/repos/edx/edx-app-android/issues/comments{/number}","contents_url":"https://api.github.com/repos/edx/edx-app-android/contents/{+path}","compare_url":"https://api.github.com/repos/edx/edx-app-android/compare/{base}...{head}","merges_url":"https://api.github.com/repos/edx/edx-app-android/merges","archive_url":"https://api.github.com/repos/edx/edx-app-android/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/edx/edx-app-android/downloads","issues_url":"https://api.github.com/repos/edx/edx-app-android/issues{/number}","pulls_url":"https://api.github.com/repos/edx/edx-app-android/pulls{/number}","milestones_url":"https://api.github.com/repos/edx/edx-app-android/milestones{/number}","notifications_url":"https://api.github.com/repos/edx/edx-app-android/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/edx/edx-app-android/labels{/name}","releases_url":"https://api.github.com/repos/edx/edx-app-android/releases{/id}","deployments_url":"https://api.github.com/repos/edx/edx-app-android/deployments","created_at":"2015-01-14T15:49:47Z","updated_at":"2016-07-14T03:30:58Z","pushed_at":"2016-07-13T18:50:34Z","git_url":"git://github.com/edx/edx-app-android.git","ssh_url":"git@github.com:edx/edx-app-android.git","clone_url":"https://github.com/edx/edx-app-android.git","svn_url":"https://github.com/edx/edx-app-android","homepage":null,"size":23187,"stargazers_count":85,"watchers_count":85,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":95,"mirror_url":null,"open_issues_count":10,"forks":95,"open_issues":10,"watchers":85,"default_branch":"master"}},"base":{"label":"edx:master","ref":"master","sha":"5fcc2db1d6649087d625d27adbeb602fd18ace0c","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":29251742,"name":"edx-app-android","full_name":"edx/edx-app-android","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-app-android","description":"","fork":false,"url":"https://api.github.com/repos/edx/edx-app-android","forks_url":"https://api.github.com/repos/edx/edx-app-android/forks","keys_url":"https://api.github.com/repos/edx/edx-app-android/keys{/key_id}","collaborators_url":"https://api.github.com/repos/edx/edx-app-android/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/edx/edx-app-android/teams","hooks_url":"https://api.github.com/repos/edx/edx-app-android/hooks","issue_events_url":"https://api.github.com/repos/edx/edx-app-android/issues/events{/number}","events_url":"https://api.github.com/repos/edx/edx-app-android/events","assignees_url":"https://api.github.com/repos/edx/edx-app-android/assignees{/user}","branches_url":"https://api.github.com/repos/edx/edx-app-android/branches{/branch}","tags_url":"https://api.github.com/repos/edx/edx-app-android/tags","blobs_url":"https://api.github.com/repos/edx/edx-app-android/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/edx/edx-app-android/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/edx/edx-app-android/git/refs{/sha}","trees_url":"https://api.github.com/repos/edx/edx-app-android/git/trees{/sha}","statuses_url":"https://api.github.com/repos/edx/edx-app-android/statuses/{sha}","languages_url":"https://api.github.com/repos/edx/edx-app-android/languages","stargazers_url":"https://api.github.com/repos/edx/edx-app-android/stargazers","contributors_url":"https://api.github.com/repos/edx/edx-app-android/contributors","subscribers_url":"https://api.github.com/repos/edx/edx-app-android/subscribers","subscription_url":"https://api.github.com/repos/edx/edx-app-android/subscription","commits_url":"https://api.github.com/repos/edx/edx-app-android/commits{/sha}","git_commits_url":"https://api.github.com/repos/edx/edx-app-android/git/commits{/sha}","comments_url":"https://api.github.com/repos/edx/edx-app-android/comments{/number}","issue_comment_url":"https://api.github.com/repos/edx/edx-app-android/issues/comments{/number}","contents_url":"https://api.github.com/repos/edx/edx-app-android/contents/{+path}","compare_url":"https://api.github.com/repos/edx/edx-app-android/compare/{base}...{head}","merges_url":"https://api.github.com/repos/edx/edx-app-android/merges","archive_url":"https://api.github.com/repos/edx/edx-app-android/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/edx/edx-app-android/downloads","issues_url":"https://api.github.com/repos/edx/edx-app-android/issues{/number}","pulls_url":"https://api.github.com/repos/edx/edx-app-android/pulls{/number}","milestones_url":"https://api.github.com/repos/edx/edx-app-android/milestones{/number}","notifications_url":"https://api.github.com/repos/edx/edx-app-android/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/edx/edx-app-android/labels{/name}","releases_url":"https://api.github.com/repos/edx/edx-app-android/releases{/id}","deployments_url":"https://api.github.com/repos/edx/edx-app-android/deployments","created_at":"2015-01-14T15:49:47Z","updated_at":"2016-07-14T03:30:58Z","pushed_at":"2016-07-13T18:50:34Z","git_url":"git://github.com/edx/edx-app-android.git","ssh_url":"git@github.com:edx/edx-app-android.git","clone_url":"https://github.com/edx/edx-app-android.git","svn_url":"https://github.com/edx/edx-app-android","homepage":null,"size":23187,"stargazers_count":85,"watchers_count":85,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":95,"mirror_url":null,"open_issues_count":10,"forks":95,"open_issues":10,"watchers":85,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/edx/edx-app-android/pulls/752"},"html":{"href":"https://github.com/edx/edx-app-android/pull/752"},"issue":{"href":"https://api.github.com/repos/edx/edx-app-android/issues/752"},"comments":{"href":"https://api.github.com/repos/edx/edx-app-android/issues/752/comments"},"review_comments":{"href":"https://api.github.com/repos/edx/edx-app-android/pulls/752/comments"},"review_comment":{"href":"https://api.github.com/repos/edx/edx-app-android/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/edx/edx-app-android/pulls/752/commits"},"statuses":{"href":"https://api.github.com/repos/edx/edx-app-android/statuses/b8715ba15340e173662fac2dd8f5238d0b72e128"}}}}
{"actor":{"display_login":"miankhalid"}}