Commit ab4d85a5 by wajeeha-khalid

MA-1305 - formatted author label to Staff & Community TA

refactor community_ta and staff in docstrings
parent 946102a3
......@@ -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 (
"staff" if user_id in self.context["staff_user_ids"] else
"community_ta" if user_id in self.context["ta_user_ids"] else
"Staff" 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")
......
......@@ -94,11 +94,11 @@ class SerializerTestMixin(CommentsServiceMockMixin, UrlResetMixin):
self.assertEqual(actual_serialized_anonymous, expected_serialized_anonymous)
@ddt.data(
(FORUM_ROLE_ADMINISTRATOR, False, "staff"),
(FORUM_ROLE_ADMINISTRATOR, False, "Staff"),
(FORUM_ROLE_ADMINISTRATOR, True, None),
(FORUM_ROLE_MODERATOR, False, "staff"),
(FORUM_ROLE_MODERATOR, False, "Staff"),
(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, "staff"),
(FORUM_ROLE_MODERATOR, "staff"),
(FORUM_ROLE_COMMUNITY_TA, "community_ta"),
(FORUM_ROLE_ADMINISTRATOR, "Staff"),
(FORUM_ROLE_MODERATOR, "Staff"),
(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.
......
......@@ -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 "staff" for moderators and
administrators or "community_ta" for community TAs
role in the course, either "Staff" for moderators and
administrators or "Community TA" for community TAs
* created_at: The ISO 8601 timestamp for the creation of the comment
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment