{"action":"created","comment":{"url":"https://api.github.com/repos/edx/edx-platform/pulls/comments/26601360","id":26601360,"diff_hunk":"@@ -960,5 +1072,206 @@ define(['backbone', 'jquery', 'js/common_helpers/ajax_helpers', 'js/common_helpe\n                     });\n                 });\n             });\n+\n+            describe(\"Discussion Topics\", function() {\n+                var createCourseWideView, createInlineView,\n+                    inlineView, courseWideView, assertCohortedTopics;\n+\n+                createCourseWideView = function(that) {\n+                    createCohortsView(that);\n+\n+                    courseWideView = new CohortCourseWideDiscussionsView({\n+                        el: cohortsView.$('.cohort-discussions-nav').removeClass('is-hidden'),\n+                        model: cohortsView.context.discussionTopicsModel,\n+                        cohortSettings: cohortsView.cohortSettings\n+                    });\n+                    courseWideView.render();\n+                };\n+\n+                createInlineView = function(that) {\n+                    createCohortsView(that);\n+\n+                    inlineView = new CohortInlineDiscussionsView({\n+                        el: cohortsView.$('.cohort-discussions-nav').removeClass('is-hidden'),\n+                        model: cohortsView.context.discussionTopicsModel,\n+                        cohortSettings: cohortsView.cohortSettings\n+                    });\n+                    inlineView.render();\n+                };\n+\n+                assertCohortedTopics = function(view, type) {\n+                    expect(view.$('.check-discussion-subcategory-' + type).length).toBe(2);\n+                    expect(view.$('.check-discussion-subcategory-' + type + ':checked').length).toBe(1);\n+                };\n+\n+                it(\"view renders properly\", function() {\n+                    showAndAssertDiscussionTopics(this);\n+                });\n+\n+                describe(\"Course Wide\", function() {\n+\n+                    it(\"save button is disabled initially\", function() {\n+                        createCourseWideView(this);\n+                        expect(courseWideView.$(courseWideDiscussionsSaveButtonCss).prop('disabled')).toBeTruthy();\n+                    });\n+\n+                    it(\"has one cohorted and one non-cohorted topic\", function() {\n+                        createCourseWideView(this);\n+\n+                        assertCohortedTopics(courseWideView, 'course-wide');\n+\n+                        expect(courseWideView.$('.cohorted-text').length).toBe(2);\n+                        expect(courseWideView.$('.cohorted-text.hidden').length).toBe(1);\n+                    });\n+\n+                    it(\"save button enabled after changing checkbox\", function() {\n+                        createCourseWideView(this);\n+\n+                        // save button is disabled.\n+                        expect(courseWideView.$(courseWideDiscussionsSaveButtonCss).prop('disabled')).toBeTruthy();\n+\n+                        $(courseWideView.$('.check-discussion-subcategory-course-wide')[0]).prop('checked', false).change();\n+\n+                        // save button is enabled.\n+                        expect(courseWideView.$(courseWideDiscussionsSaveButtonCss).prop('disabled')).toBeFalsy();\n+                    });\n+\n+                    it(\"save the topics\", function() {\n+                        createCourseWideView(this);\n+\n+                        $(courseWideView.$('.check-discussion-subcategory-course-wide')[1]).prop('checked', 'checked').change();\n+                        expect(courseWideView.$(courseWideDiscussionsSaveButtonCss).prop('disabled')).toBeFalsy();\n+\n+                        // Save the updated settings\n+                        courseWideView.$('.action-save').click();\n+\n+                        // fake requests for cohort settings with PATCH method.\n+                        AjaxHelpers.expectJsonRequest(\n+                            requests, 'PATCH', '/mock_service/cohorts/settings',\n+                            {cohorted_course_wide_discussions: ['Topic_C_1', 'Topic_C_2']}\n+                        );\n+                        AjaxHelpers.respondWithJson(\n+                            requests,\n+                            {cohorted_course_wide_discussions: ['Topic_C_1', 'Topic_C_2']}\n+                        );\n+\n+                        // fake request for discussion/topics with GET method.\n+                        AjaxHelpers.expectJsonRequest(\n+                            requests, 'GET', '/mock_service/cohorts/discussion/topics'\n+                        );\n+                        AjaxHelpers.respondWithJson(\n+                            requests,\n+                            createMockCohortDiscussions()\n+                        );\n+\n+                        // verify the success message.\n+                        expect(courseWideView.$(courseWideDiscussionsSaveButtonCss).prop('disabled')).toBeTruthy();\n+                        verifyMessage('Changes Saved.', 'confirmation');\n+                    });\n+\n+                    it('shows an appropriate error message for HTTP500', function () {\n+                        createCourseWideView(this);\n+\n+                        $(courseWideView.$('.check-discussion-subcategory-course-wide')[1]).prop('checked', 'checked').change();\n+                        courseWideView.$('.action-save').click();\n+\n+                        AjaxHelpers.respondWithError(requests, 500);\n+                        var expectedTitle = \"We've encountered an error. Refresh your browser and then try again.\"\n+                        expect(courseWideView.$('.message-title').text().trim()).toBe(expectedTitle);\n+                    });\n+                });\n+\n+                describe(\"Inline\", function() {\n+                    var enableSaveButton;\n+\n+                    enableSaveButton = function() {\n+                        // enable the inline discussion topics.\n+                        inlineView.$('.check-cohort-inline-discussions').prop('checked', 'checked').change();\n+\n+                        $(inlineView.$('.check-discussion-subcategory-inline')[0]).prop('checked', 'checked').change();\n+\n+                        expect(inlineView.$(inlineDiscussionsSaveButtonCss).prop('disabled')).toBeFalsy();\n+                    };\n+\n+                    it(\"save button is disabled initially\", function() {\n+                        createInlineView(this);\n+                        expect(inlineView.$(inlineDiscussionsSaveButtonCss).prop('disabled')).toBeTruthy();\n+                    });\n+\n+                    it(\"always cohort radio button is selected\", function() {","path":"lms/static/js/spec/groups/views/cohorts_spec.js","position":370,"original_position":370,"commit_id":"782a4054b930883d16030e3c555ee915d2dcd32e","original_commit_id":"782a4054b930883d16030e3c555ee915d2dcd32e","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":"Add tests for switching back and forth between always cohort and manually cohort.","created_at":"2015-03-17T18:28:14Z","updated_at":"2015-03-17T18:28:14Z","html_url":"https://github.com/edx/edx-platform/pull/7321#discussion_r26601360","pull_request_url":"https://api.github.com/repos/edx/edx-platform/pulls/7321","_links":{"self":{"href":"https://api.github.com/repos/edx/edx-platform/pulls/comments/26601360"},"html":{"href":"https://github.com/edx/edx-platform/pull/7321#discussion_r26601360"},"pull_request":{"href":"https://api.github.com/repos/edx/edx-platform/pulls/7321"}}},"pull_request":{"url":"https://api.github.com/repos/edx/edx-platform/pulls/7321","id":31009090,"html_url":"https://github.com/edx/edx-platform/pull/7321","diff_url":"https://github.com/edx/edx-platform/pull/7321.diff","patch_url":"https://github.com/edx/edx-platform/pull/7321.patch","issue_url":"https://api.github.com/repos/edx/edx-platform/issues/7321","number":7321,"state":"open","locked":false,"title":"Cohort course-wide and inline discussion topics[UI].","user":{"login":"muzaffaryousaf","id":2994509,"avatar_url":"https://avatars.githubusercontent.com/u/2994509?v=3","gravatar_id":"","url":"https://api.github.com/users/muzaffaryousaf","html_url":"https://github.com/muzaffaryousaf","followers_url":"https://api.github.com/users/muzaffaryousaf/followers","following_url":"https://api.github.com/users/muzaffaryousaf/following{/other_user}","gists_url":"https://api.github.com/users/muzaffaryousaf/gists{/gist_id}","starred_url":"https://api.github.com/users/muzaffaryousaf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/muzaffaryousaf/subscriptions","organizations_url":"https://api.github.com/users/muzaffaryousaf/orgs","repos_url":"https://api.github.com/users/muzaffaryousaf/repos","events_url":"https://api.github.com/users/muzaffaryousaf/events{/privacy}","received_events_url":"https://api.github.com/users/muzaffaryousaf/received_events","type":"User","site_admin":false},"body":"Ticket # https://openedx.atlassian.net/browse/TNL-1256 \r\n\r\nThis adds the UI to the cohort management tab on LMS side. It allows the staff to cohort the course-wide as well as, inline discussions via friendly UI. \r\n\r\nThe Sandbox is available at: http://cohort-discussions.m.sandbox.edx.org/","created_at":"2015-03-12T05:21:40Z","updated_at":"2015-03-17T18:28:14Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d5dce3da801e86eecfbc4ed308f8d6457bffa560","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/edx/edx-platform/pulls/7321/commits","review_comments_url":"https://api.github.com/repos/edx/edx-platform/pulls/7321/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/7321/comments","statuses_url":"https://api.github.com/repos/edx/edx-platform/statuses/782a4054b930883d16030e3c555ee915d2dcd32e","head":{"label":"edx:muzaffar/cohort-discussions-tnl1256","ref":"muzaffar/cohort-discussions-tnl1256","sha":"782a4054b930883d16030e3c555ee915d2dcd32e","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":"Open edX, the edX platform that powers http://edx.org","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-03-17T18:01:20Z","pushed_at":"2015-03-17T18:25:31Z","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://openedx.org/","size":1824397,"stargazers_count":1797,"watchers_count":1797,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":1023,"mirror_url":null,"open_issues_count":143,"forks":1023,"open_issues":143,"watchers":1797,"default_branch":"master"}},"base":{"label":"edx:ammar/move-cohort-management-tnl-1268","ref":"ammar/move-cohort-management-tnl-1268","sha":"581ffdd553480556c679bc8a2a75165fd656960c","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":"Open edX, the edX platform that powers http://edx.org","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-03-17T18:01:20Z","pushed_at":"2015-03-17T18:25:31Z","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://openedx.org/","size":1824397,"stargazers_count":1797,"watchers_count":1797,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":1023,"mirror_url":null,"open_issues_count":143,"forks":1023,"open_issues":143,"watchers":1797,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/edx/edx-platform/pulls/7321"},"html":{"href":"https://github.com/edx/edx-platform/pull/7321"},"issue":{"href":"https://api.github.com/repos/edx/edx-platform/issues/7321"},"comments":{"href":"https://api.github.com/repos/edx/edx-platform/issues/7321/comments"},"review_comments":{"href":"https://api.github.com/repos/edx/edx-platform/pulls/7321/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/7321/commits"},"statuses":{"href":"https://api.github.com/repos/edx/edx-platform/statuses/782a4054b930883d16030e3c555ee915d2dcd32e"}}}}