Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
6d48e136
Commit
6d48e136
authored
Jul 31, 2015
by
Ben McMorran
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Extend is_commentable_cohorted to support teams
parent
b06e46c1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
2 deletions
+21
-2
lms/djangoapps/django_comment_client/tests/group_id.py
+7
-0
lms/djangoapps/django_comment_client/tests/test_utils.py
+12
-0
lms/djangoapps/django_comment_client/utils.py
+2
-2
No files found.
lms/djangoapps/django_comment_client/tests/group_id.py
View file @
6d48e136
import
json
import
re
from
teams.tests.factories
import
CourseTeamFactory
class
GroupIdAssertionMixin
(
object
):
...
...
@@ -145,3 +146,9 @@ class NonCohortedTopicGroupIdTestMixin(GroupIdAssertionMixin):
invalid_id
=
self
.
student_cohort
.
id
+
self
.
moderator_cohort
.
id
self
.
call_view
(
mock_request
,
"non_cohorted_topic"
,
self
.
moderator
,
invalid_id
)
self
.
_assert_comments_service_called_without_group_id
(
mock_request
)
def
test_team_discussion_id_not_cohorted
(
self
,
mock_request
):
team
=
CourseTeamFactory
(
course_id
=
self
.
course
.
id
)
team
.
add_user
(
self
.
student
)
# pylint: disable=no-member
self
.
call_view
(
mock_request
,
team
.
discussion_topic_id
,
self
.
student
,
None
)
self
.
_assert_comments_service_called_without_group_id
(
mock_request
)
lms/djangoapps/django_comment_client/tests/test_utils.py
View file @
6d48e136
...
...
@@ -26,6 +26,7 @@ from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory
from
xmodule.modulestore.tests.django_utils
import
ModuleStoreTestCase
,
TEST_DATA_MIXED_TOY_MODULESTORE
from
xmodule.modulestore.django
import
modulestore
from
opaque_keys.edx.locator
import
CourseLocator
from
teams.tests.factories
import
CourseTeamFactory
@attr
(
'shard_1'
)
...
...
@@ -1209,3 +1210,14 @@ class IsCommentableCohortedTestCase(ModuleStoreTestCase):
utils
.
is_commentable_cohorted
(
course
.
id
,
to_id
(
"Feedback"
)),
"If always_cohort_inline_discussions set to False, top-level discussion are not affected."
)
def
test_is_commentable_cohorted_team
(
self
):
course
=
modulestore
()
.
get_course
(
self
.
toy_course_key
)
self
.
assertFalse
(
cohorts
.
is_course_cohorted
(
course
.
id
))
config_course_cohorts
(
course
,
is_cohorted
=
True
)
team
=
CourseTeamFactory
(
course_id
=
course
.
id
)
# Verify that team discussions are not cohorted, but other discussions are
self
.
assertFalse
(
utils
.
is_commentable_cohorted
(
course
.
id
,
team
.
discussion_topic_id
))
self
.
assertTrue
(
utils
.
is_commentable_cohorted
(
course
.
id
,
"random"
))
lms/djangoapps/django_comment_client/utils.py
View file @
6d48e136
...
...
@@ -15,7 +15,7 @@ from opaque_keys.edx.keys import CourseKey
from
xmodule.modulestore.django
import
modulestore
from
django_comment_common.models
import
Role
,
FORUM_ROLE_STUDENT
from
django_comment_client.permissions
import
check_permissions_by_view
,
has_permission
from
django_comment_client.permissions
import
check_permissions_by_view
,
has_permission
,
get_team
from
django_comment_client.settings
import
MAX_COMMENT_DEPTH
from
edxmako
import
lookup_template
...
...
@@ -678,7 +678,7 @@ def is_commentable_cohorted(course_key, commentable_id):
course
=
courses
.
get_course_by_id
(
course_key
)
course_cohort_settings
=
get_course_cohort_settings
(
course_key
)
if
not
course_cohort_settings
.
is_cohorted
:
if
not
course_cohort_settings
.
is_cohorted
or
get_team
(
commentable_id
)
:
# this is the easy case :)
ans
=
False
elif
(
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment