From 7d776a11aae0decc3525804658c9142ca78d06bc Mon Sep 17 00:00:00 2001 From: Ali Salman Date: Tue, 28 Nov 2023 12:48:35 +0500 Subject: [PATCH] update: add profile_image_url in metadata view --- lms/djangoapps/course_home_api/course_metadata/serializers.py | 1 + lms/djangoapps/course_home_api/course_metadata/views.py | 2 ++ 2 files changed, 3 insertions(+) diff --git a/lms/djangoapps/course_home_api/course_metadata/serializers.py b/lms/djangoapps/course_home_api/course_metadata/serializers.py index b140938f7e2d..25315bc63983 100644 --- a/lms/djangoapps/course_home_api/course_metadata/serializers.py +++ b/lms/djangoapps/course_home_api/course_metadata/serializers.py @@ -48,3 +48,4 @@ class CourseHomeMetadataSerializer(VerifiedModeSerializer): username = serializers.CharField() user_timezone = serializers.CharField() can_view_certificate = serializers.BooleanField() + profile_image_url = serializers.CharField() diff --git a/lms/djangoapps/course_home_api/course_metadata/views.py b/lms/djangoapps/course_home_api/course_metadata/views.py index e534d03ebbf7..ee55ebd77380 100644 --- a/lms/djangoapps/course_home_api/course_metadata/views.py +++ b/lms/djangoapps/course_home_api/course_metadata/views.py @@ -11,6 +11,7 @@ from lms.djangoapps.certificates.api import certificates_viewable_for_course from openedx.core.lib.api.authentication import BearerAuthenticationAllowInactiveUser from openedx.core.djangoapps.courseware_api.utils import get_celebrations_dict +from openedx.core.djangoapps.user_api.accounts.image_helpers import get_profile_image_urls_for_user from common.djangoapps.student.models import CourseEnrollment from lms.djangoapps.course_api.api import course_detail @@ -130,6 +131,7 @@ def get(self, request, *args, **kwargs): 'celebrations': celebrations, 'user_timezone': user_timezone, 'can_view_certificate': certificates_viewable_for_course(course), + 'profile_image_url': get_profile_image_urls_for_user(request.user)['medium'], } context = self.get_serializer_context() context['course'] = course