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
f0c694e5
Commit
f0c694e5
authored
Jul 07, 2017
by
Sofiya Semenova
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Review round 1
parent
f1116554
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
4 deletions
+9
-4
lms/djangoapps/django_comment_client/tests/test_utils.py
+5
-1
lms/djangoapps/django_comment_client/utils.py
+4
-3
No files found.
lms/djangoapps/django_comment_client/tests/test_utils.py
View file @
f0c694e5
...
...
@@ -1696,6 +1696,10 @@ class GroupModeratorPermissionsTestCase(ModuleStoreTestCase):
"""Test utils functionality related to forums "abilities" (permissions) for group moderators"""
def
_check_condition
(
user
,
condition
,
content
):
"""
Mocks check_condition method because is_open and is_team_member_if_applicable must always be true
in order to interact with a thread or comment.
"""
return
True
if
condition
==
'is_open'
or
condition
==
'is_team_member_if_applicable'
else
False
def
setUp
(
self
):
...
...
@@ -1716,7 +1720,7 @@ class GroupModeratorPermissionsTestCase(ModuleStoreTestCase):
# Create four users: group_moderator (who is within the verified enrollment track and in the cohort),
# verified_user (who is in the verified enrollment track but not the cohort),
# cohorted_user (who is in the cohort but not the verified enrollment track),
# and plain_user (who is neither in the cohort nor the verified enrollment track)
x
# and plain_user (who is neither in the cohort nor the verified enrollment track)
self
.
group_moderator
=
UserFactory
(
username
=
'group_moderator'
,
email
=
'group_moderator@edx.org'
)
self
.
group_moderator
.
id
=
1
CourseEnrollmentFactory
(
...
...
lms/djangoapps/django_comment_client/utils.py
View file @
f0c694e5
...
...
@@ -569,14 +569,15 @@ def get_user_group_ids(course_id, content, user=None):
content_user_group_id
=
None
user_group_id
=
None
if
course_id
is
not
None
:
course_discussion_settings
=
get_course_discussion_settings
(
course_id
)
if
content
.
get
(
'username'
):
try
:
content_user
=
get_user_by_username_or_email
(
content
.
get
(
'username'
))
content_user_group_id
=
get_group_id_for_user
(
content_user
,
get_course_discussion_settings
(
course_id
)
)
content_user_group_id
=
get_group_id_for_user
(
content_user
,
course_discussion_settings
)
except
User
.
DoesNotExist
:
content_user_group_id
=
None
user_group_id
=
get_group_id_for_user
(
user
,
get_course_discussion_settings
(
course_id
)
)
if
user
else
None
user_group_id
=
get_group_id_for_user
(
user
,
course_discussion_settings
)
if
user
else
None
return
user_group_id
,
content_user_group_id
...
...
@@ -822,7 +823,7 @@ def get_group_id_for_user(user, course_discussion_settings):
elif
division_scheme
==
CourseDiscussionSettings
.
ENROLLMENT_TRACK
:
partition_service
=
PartitionService
(
course_discussion_settings
.
course_id
)
group_id
=
partition_service
.
get_user_group_id_for_partition
(
user
,
ENROLLMENT_TRACK_PARTITION_ID
)
# We negate the group_ids from dynamic
[
partitions so that they will not conflict
# We negate the group_ids from dynamic partitions so that they will not conflict
# with cohort IDs (which are an auto-incrementing integer field, starting at 1).
return
-
1
*
group_id
if
group_id
is
not
None
else
None
else
:
...
...
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