diff --git a/lms/djangoapps/discussion/rest_api/api.py b/lms/djangoapps/discussion/rest_api/api.py index 836eea62e7..0c98248874 100644 --- a/lms/djangoapps/discussion/rest_api/api.py +++ b/lms/djangoapps/discussion/rest_api/api.py @@ -106,6 +106,7 @@ from .forms import CommentActionsForm, ThreadActionsForm, UserOrdering from .pagination import DiscussionAPIPagination from .permissions import ( can_delete, + can_take_action_on_spam, get_editable_fields, get_initializable_comment_fields, get_initializable_thread_fields @@ -354,6 +355,7 @@ def get_course(request, course_key, check_tab=True): "allow_anonymous": course.allow_anonymous, "allow_anonymous_to_peers": course.allow_anonymous_to_peers, "user_roles": user_roles, + "has_bulk_delete_privileges": can_take_action_on_spam(request.user, course_key), "has_moderation_privileges": bool(user_roles & { FORUM_ROLE_ADMINISTRATOR, FORUM_ROLE_MODERATOR, @@ -381,8 +383,9 @@ def get_course(request, course_key, check_tab=True): 'captcha_settings': { 'enabled': is_captcha_enabled(course_key), 'site_key': settings.RECAPTCHA_SITE_KEY, - } - + }, + "is_email_verified": request.user.is_active, + "only_verified_users_can_post": False, } diff --git a/lms/djangoapps/discussion/rest_api/tests/test_api.py b/lms/djangoapps/discussion/rest_api/tests/test_api.py index a571e395a9..3a766b55c5 100644 --- a/lms/djangoapps/discussion/rest_api/tests/test_api.py +++ b/lms/djangoapps/discussion/rest_api/tests/test_api.py @@ -205,6 +205,7 @@ class GetCourseTest(ForumsEnableMixin, UrlResetMixin, SharedModuleStoreTestCase) 'enable_in_context': True, 'group_at_subsection': False, 'provider': 'legacy', + "has_bulk_delete_privileges": False, 'has_moderation_privileges': False, "is_course_staff": False, "is_course_admin": False, @@ -219,6 +220,8 @@ class GetCourseTest(ForumsEnableMixin, UrlResetMixin, SharedModuleStoreTestCase) 'enabled': False, 'site_key': '', }, + "is_email_verified": True, + "only_verified_users_can_post": False } @ddt.data( diff --git a/lms/djangoapps/discussion/rest_api/tests/test_views.py b/lms/djangoapps/discussion/rest_api/tests/test_views.py index 0f12531516..2f457db5fe 100644 --- a/lms/djangoapps/discussion/rest_api/tests/test_views.py +++ b/lms/djangoapps/discussion/rest_api/tests/test_views.py @@ -548,6 +548,7 @@ class CourseViewTest(DiscussionAPIViewTestMixin, ModuleStoreTestCase): "provider": "legacy", "allow_anonymous": True, "allow_anonymous_to_peers": False, + "has_bulk_delete_privileges": False, "has_moderation_privileges": False, 'is_course_admin': False, 'is_course_staff': False, @@ -562,6 +563,8 @@ class CourseViewTest(DiscussionAPIViewTestMixin, ModuleStoreTestCase): 'enabled': False, 'site_key': '', }, + "is_email_verified": True, + "only_verified_users_can_post": False } )