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
ab4d85a5
Commit
ab4d85a5
authored
Sep 21, 2015
by
wajeeha-khalid
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MA-1305 - formatted author label to Staff & Community TA
refactor community_ta and staff in docstrings
parent
946102a3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
14 deletions
+14
-14
lms/djangoapps/discussion_api/serializers.py
+4
-4
lms/djangoapps/discussion_api/tests/test_serializers.py
+8
-8
lms/djangoapps/discussion_api/views.py
+2
-2
No files found.
lms/djangoapps/discussion_api/serializers.py
View file @
ab4d85a5
...
...
@@ -120,12 +120,12 @@ class _ContentSerializer(serializers.Serializer):
def
_get_user_label
(
self
,
user_id
):
"""
Returns the role label (i.e. "
staff" or "community_ta
") for the user
Returns the role label (i.e. "
Staff" or "Community TA
") for the user
with the given id.
"""
return
(
"
s
taff"
if
user_id
in
self
.
context
[
"staff_user_ids"
]
else
"
community_ta
"
if
user_id
in
self
.
context
[
"ta_user_ids"
]
else
"
S
taff"
if
user_id
in
self
.
context
[
"staff_user_ids"
]
else
"
Community TA
"
if
user_id
in
self
.
context
[
"ta_user_ids"
]
else
None
)
...
...
@@ -283,7 +283,7 @@ class CommentSerializer(_ContentSerializer):
def
get_endorsed_by_label
(
self
,
obj
):
"""
Returns the role label (i.e. "
staff" or "community_ta
") for the
Returns the role label (i.e. "
Staff" or "Community TA
") for the
endorsing user
"""
endorsement
=
obj
.
get
(
"endorsement"
)
...
...
lms/djangoapps/discussion_api/tests/test_serializers.py
View file @
ab4d85a5
...
...
@@ -94,11 +94,11 @@ class SerializerTestMixin(CommentsServiceMockMixin, UrlResetMixin):
self
.
assertEqual
(
actual_serialized_anonymous
,
expected_serialized_anonymous
)
@ddt.data
(
(
FORUM_ROLE_ADMINISTRATOR
,
False
,
"
s
taff"
),
(
FORUM_ROLE_ADMINISTRATOR
,
False
,
"
S
taff"
),
(
FORUM_ROLE_ADMINISTRATOR
,
True
,
None
),
(
FORUM_ROLE_MODERATOR
,
False
,
"
s
taff"
),
(
FORUM_ROLE_MODERATOR
,
False
,
"
S
taff"
),
(
FORUM_ROLE_MODERATOR
,
True
,
None
),
(
FORUM_ROLE_COMMUNITY_TA
,
False
,
"
community_ta
"
),
(
FORUM_ROLE_COMMUNITY_TA
,
False
,
"
Community TA
"
),
(
FORUM_ROLE_COMMUNITY_TA
,
True
,
None
),
(
FORUM_ROLE_STUDENT
,
False
,
None
),
(
FORUM_ROLE_STUDENT
,
True
,
None
),
...
...
@@ -108,7 +108,7 @@ class SerializerTestMixin(CommentsServiceMockMixin, UrlResetMixin):
"""
Test correctness of the author_label field.
The label should be "
staff", "staff", or "community_ta
" for the
The label should be "
Staff", "Staff", or "Community TA
" for the
Administrator, Moderator, and Community TA roles, respectively, but
the label should not be present if the content is anonymous.
...
...
@@ -352,9 +352,9 @@ class CommentSerializerTest(SerializerTestMixin, SharedModuleStoreTestCase):
self
.
assertEqual
(
actual_endorser_anonymous
,
expected_endorser_anonymous
)
@ddt.data
(
(
FORUM_ROLE_ADMINISTRATOR
,
"
s
taff"
),
(
FORUM_ROLE_MODERATOR
,
"
s
taff"
),
(
FORUM_ROLE_COMMUNITY_TA
,
"
community_ta
"
),
(
FORUM_ROLE_ADMINISTRATOR
,
"
S
taff"
),
(
FORUM_ROLE_MODERATOR
,
"
S
taff"
),
(
FORUM_ROLE_COMMUNITY_TA
,
"
Community TA
"
),
(
FORUM_ROLE_STUDENT
,
None
),
)
@ddt.unpack
...
...
@@ -362,7 +362,7 @@ class CommentSerializerTest(SerializerTestMixin, SharedModuleStoreTestCase):
"""
Test correctness of the endorsed_by_label field.
The label should be "
staff", "staff", or "community_ta
" for the
The label should be "
Staff", "Staff", or "Community TA
" for the
Administrator, Moderator, and Community TA roles, respectively.
role_name is the name of the author's role.
...
...
lms/djangoapps/discussion_api/views.py
View file @
ab4d85a5
...
...
@@ -358,8 +358,8 @@ class CommentViewSet(_ViewMixin, DeveloperErrorViewMixin, ViewSet):
comment is anonymous
* author_label: A label indicating whether the author has a special
role in the course, either "
s
taff" for moderators and
administrators or "
community_ta
" for community TAs
role in the course, either "
S
taff" for moderators and
administrators or "
Community TA
" for community TAs
* created_at: The ISO 8601 timestamp for the creation of the comment
...
...
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