{"action":"created","issue":{"url":"https://api.github.com/repos/edx-solutions/edx-platform/issues/744","repository_url":"https://api.github.com/repos/edx-solutions/edx-platform","labels_url":"https://api.github.com/repos/edx-solutions/edx-platform/issues/744/labels{/name}","comments_url":"https://api.github.com/repos/edx-solutions/edx-platform/issues/744/comments","events_url":"https://api.github.com/repos/edx-solutions/edx-platform/issues/744/events","html_url":"https://github.com/edx-solutions/edx-platform/pull/744","id":177464227,"number":744,"title":"Have DiscussionXBlock and DiscussionCourseXBlock take care of loading assets they depend on","user":{"login":"itsjeyd","id":961441,"avatar_url":"https://avatars.githubusercontent.com/u/961441?v=3","gravatar_id":"","url":"https://api.github.com/users/itsjeyd","html_url":"https://github.com/itsjeyd","followers_url":"https://api.github.com/users/itsjeyd/followers","following_url":"https://api.github.com/users/itsjeyd/following{/other_user}","gists_url":"https://api.github.com/users/itsjeyd/gists{/gist_id}","starred_url":"https://api.github.com/users/itsjeyd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/itsjeyd/subscriptions","organizations_url":"https://api.github.com/users/itsjeyd/orgs","repos_url":"https://api.github.com/users/itsjeyd/repos","events_url":"https://api.github.com/users/itsjeyd/events{/privacy}","received_events_url":"https://api.github.com/users/itsjeyd/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-09-16T16:13:46Z","updated_at":"2016-09-26T08:31:29Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/edx-solutions/edx-platform/pulls/744","html_url":"https://github.com/edx-solutions/edx-platform/pull/744","diff_url":"https://github.com/edx-solutions/edx-platform/pull/744.diff","patch_url":"https://github.com/edx-solutions/edx-platform/pull/744.patch"},"body":"`DiscussionXBlock` currently relies on courseware to load JS and CSS assets that it depends on. This PR transfers responsibility for loading these assets to the XBlock itself.\r\n\r\n`DiscussionCourseXBlock` was already taking care of loading *some* necessary assets. This PR makes sure that the block loads all assets it depends on.\r\n\r\ncf. [YONK-382](https://openedx.atlassian.net/browse/YONK-382)\r\n\r\n**Related PRs**\r\n\r\n- https://github.com/edx/edx-platform/pull/13483\r\n\r\n**Dependencies**\r\n\r\n- https://github.com/edx-solutions/edx-platform/pull/743 (commits included here until that PR merges)\r\n- https://github.com/edx-solutions/cs_comments_service/pull/18\r\n- https://github.com/edx-solutions/jquery-xblock/pull/24\r\n\r\n**Relevant commits**\r\n\r\nAll commits by me. Haven't squashed them yet to keep history transparent. To make it easier to review the changes, I created a separate [branch](https://github.com/open-craft/edx-platform/tree/itsjeyd/discussion-assets-squashed) with a single commit (https://github.com/open-craft/edx-platform/commit/117350e2aad0aacf7e6218b65c0bdab2faf33d38) that combines changes from relevant commits.\r\n\r\n<!--\r\n* Commit containing changes prior to internal review: https://github.com/open-craft/edx-platform/commit/a3f1c55ddc09130f194b8b5565aa445e96a8ee8d\r\n* Commit containing changes prior to rebase: https://github.com/open-craft/edx-platform/commit/f3bce6f9eb4b45972b18944be9ccbe1bd658c75f\r\n-->\r\n\r\n**Screenshots**\r\n\r\n- Adding a post: ![add-a-post](https://cloud.githubusercontent.com/assets/961441/18811656/f111cd80-82b7-11e6-8e48-2f25fbcab7a5.png)\r\n\r\n- Expanded discussion: ![post-mathjax-expanded](https://cloud.githubusercontent.com/assets/961441/18811671/6cb8bc50-82b8-11e6-8db3-84a35e435a35.png)\r\n\r\n- Responses: ![response-comment-mathjax](https://cloud.githubusercontent.com/assets/961441/18811685/e9c014f0-82b8-11e6-95ba-001df32ad9fb.png)\r\n\r\n- Error message: ![post-with-error](https://cloud.githubusercontent.com/assets/961441/18817460/030e2278-8361-11e6-9e9a-f40f7e99d74e.png)\r\n\r\n**Setup instructions**\r\n\r\n1. Get Studio, LMS, and Apros running on the parent branch (`ziafazal/fix-broken-features`), then checkout this branch. List of commits to use:\r\n\r\n    * `edx-platform`: Latest commit on this branch.\r\n    * `cs_comments_service`: https://github.com/edx-solutions/cs_comments_service/commit/10826f6c7b9a597c527bf9752f16567e5025d27e\r\n    * Apros: `master` @ `b7e058b`\r\n\r\n2. As `edxapp` user, remove static assets via `git clean -fx`.\r\n\r\n3. As `edxapp` user, rebuild assets via `paver update_assets` *or* `paver devstack studio`, `paver devstack lms`.\r\n\r\n4. Install changes from https://github.com/edx-solutions/jquery-xblock/pull/24: In Apros repo, replace contents of `static/js/vendor/jquery.xblock.js` with contents of [updated version](https://raw.githubusercontent.com/edx-solutions/jquery-xblock/2037d7411a063124bcc0e10615edfbd8db67c3b2/jquery.xblock.js).\r\n\r\n5. As `apros` user, run `./manage.py collectstatic --noinput` and make sure `jquery.xblock.js` is mentioned in the output as one of the files that got updated.\r\n\r\n**Test instructions**\r\n\r\n1. Add `DiscussionXBlock` to a unit via the main \"Discussion\" component button.\r\n\r\n2. Add `discussion-course` to advanced modules.\r\n\r\n3. Create a new section called `DISCUSSION_TAB`.\r\n\r\n4. Add a subsection and unit to the `DISCUSSION_TAB` section created in the previous step.\r\n\r\n5. Select \"Advanced\" > \"Discussion Course\" to add an instance of `DiscussionCourseXBlock` to the unit.\r\n\r\n6. Navigate to unit containing `DiscussionXBlock` in the LMS and smoke test discussion functionality.\r\n\r\n    For example, make sure that you can perform the following actions as `staff` user:\r\n\r\n    * Create a Post, Reply, Comment.\r\n    * Edit a Post, Reply, Comment.\r\n    * Test [MathJax](http://docs.mathjax.org/en/latest/start.html) functionality in Post, Reply, Comment (and Preview), with e.g.\r\n      ```\r\nThere are two solutions to \\(ax^2 + bx + c = 0\\) and they are\r\n$$x = {-b \\pm \\sqrt{b^2-4ac} \\over 2a}.$$\r\n\r\nWhen $a \\ne 0$\r\n      ```\r\n    * Delete a Post, Reply, Comment.\r\n    * Follow/unfollow a thread/post.\r\n    * In the \"Instructor\" panel, add the `staff` user to the `Discussion Admin` or `Discussion Moderator` group. Then you should be able to: \r\n        * Open/close a thread/post.\r\n        * Pin/unpin a thread/post.\r\n    * Try to create a post without a title. This should cause an error message to be displayed above the controls you used to create the post.\r\n\r\n6. Login as a regular student.  You should be able to do the above actions, plus:\r\n\r\n    * Report/unreport a post created by the `staff` user.\r\n    * Vote/unvote a thread/post created by the `staff` user.\r\n\r\n7. Repeat previous steps for unit containing `DiscussionCourseXBlock`.\r\n\r\n8. In Apros, navigate to unit containing `DiscussionXBlock` and repeat previous steps. Performing some of the actions will be a little fiddly because CSS for `DiscussionXBlock` does not match Apros CSS yet (cf. \"Author notes\" below).\r\n\r\n  <!-- Make sure you can \"Show discussion\", expand and collapse threads, and show/dismiss the form for adding a new post by clicking \"Add a Post\"/\"Cancel\". -->\r\n\r\n9. In Apros, navigate to (equivalent of) \"Discussion\" tab and repeat previous steps. The CSS for `DiscussionCourseXBlock` does not match Apros CSS yet (cf. \"Author notes\" below), so some UI elements will look a little weird.\r\n\r\n  <!-- Make sure you can search for posts in the sidebar, view individual threads by selecting them from the sidebar, and show/dismiss the form for adding a new post by clicking \"New post\"/\"Cancel\". -->\r\n\r\n**Author notes**\r\n\r\n- CSS for both `DiscussionXBlock` and `DiscussionCourseXBlock` does not match Apros CSS yet. We have a separate ticket for addressing this: [YONK-383](https://openedx.atlassian.net/browse/YONK-383).\r\n\r\n**Reviewers**\r\n\r\n- [x] OpenCraft: @pomegranited \r\n- [ ] Solutions: @ziafazal "},"comment":{"url":"https://api.github.com/repos/edx-solutions/edx-platform/issues/comments/249510032","html_url":"https://github.com/edx-solutions/edx-platform/pull/744#issuecomment-249510032","issue_url":"https://api.github.com/repos/edx-solutions/edx-platform/issues/744","id":249510032,"user":{"login":"itsjeyd","id":961441,"avatar_url":"https://avatars.githubusercontent.com/u/961441?v=3","gravatar_id":"","url":"https://api.github.com/users/itsjeyd","html_url":"https://github.com/itsjeyd","followers_url":"https://api.github.com/users/itsjeyd/followers","following_url":"https://api.github.com/users/itsjeyd/following{/other_user}","gists_url":"https://api.github.com/users/itsjeyd/gists{/gist_id}","starred_url":"https://api.github.com/users/itsjeyd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/itsjeyd/subscriptions","organizations_url":"https://api.github.com/users/itsjeyd/orgs","repos_url":"https://api.github.com/users/itsjeyd/repos","events_url":"https://api.github.com/users/itsjeyd/events{/privacy}","received_events_url":"https://api.github.com/users/itsjeyd/received_events","type":"User","site_admin":false},"created_at":"2016-09-26T08:31:29Z","updated_at":"2016-09-26T08:31:29Z","body":"@pomegranited Thanks for the review! I addressed your comments, updated the PR description, and integrated the commit (https://github.com/edx-solutions/edx-platform/pull/743/commits/2a22dba2bd19df1b5517713441463b777d53fcd6) that you added to https://github.com/edx-solutions/edx-platform/pull/743.\r\n\r\n@ziafazal This is ready for you to have a look. It builds on https://github.com/edx-solutions/edx-platform/pull/743. To only see the changes introduced here, see this commit: https://github.com/open-craft/edx-platform/commit/117350e2aad0aacf7e6218b65c0bdab2faf33d38. Thanks!"}}
{"actor":{"display_login":"itsjeyd"}}