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
e77bcab5
Commit
e77bcab5
authored
Jan 09, 2015
by
Nimisha Asthagiri
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MA-345 Mobile Enrollment API: add course' Facebook URL
parent
4e454cca
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
34 additions
and
2 deletions
+34
-2
cms/djangoapps/models/settings/course_metadata.py
+4
-0
common/lib/xmodule/xmodule/course_module.py
+9
-0
lms/djangoapps/mobile_api/users/serializers.py
+3
-0
lms/djangoapps/mobile_api/users/tests.py
+18
-2
No files found.
cms/djangoapps/models/settings/course_metadata.py
View file @
e77bcab5
...
...
@@ -64,6 +64,10 @@ class CourseMetadata(object):
if
not
settings
.
FEATURES
.
get
(
'ENABLE_VIDEO_UPLOAD_PIPELINE'
):
filtered_list
.
append
(
'video_upload_pipeline'
)
# Do not show facebook_url if the feature is disabled.
if
not
settings
.
FEATURES
.
get
(
'ENABLE_MOBILE_SOCIAL_FACEBOOK_FEATURES'
):
filtered_list
.
append
(
'facebook_url'
)
return
filtered_list
@classmethod
...
...
common/lib/xmodule/xmodule/course_module.py
View file @
e77bcab5
...
...
@@ -335,6 +335,15 @@ class CourseFields(object):
help
=
_
(
"Enter the unique identifier for your course's video files provided by edX."
),
scope
=
Scope
.
settings
)
facebook_url
=
String
(
help
=
_
(
"Enter the URL for the official course Facebook group. "
"If you provide a URL, the mobile app includes a button that students can tap to access the group."
),
default
=
None
,
display_name
=
_
(
"Facebook URL"
),
scope
=
Scope
.
settings
)
no_grade
=
Boolean
(
display_name
=
_
(
"Course Not Graded"
),
help
=
_
(
"Enter true or false. If true, the course will not be graded."
),
...
...
lms/djangoapps/mobile_api/users/serializers.py
View file @
e77bcab5
...
...
@@ -50,6 +50,9 @@ class CourseField(serializers.RelatedField):
"start"
:
course
.
start
,
"end"
:
course
.
end
,
"course_image"
:
course_image_url
(
course
),
"social_urls"
:
{
"facebook"
:
course
.
facebook_url
,
},
"latest_updates"
:
{
"video"
:
None
},
...
...
lms/djangoapps/mobile_api/users/tests.py
View file @
e77bcab5
...
...
@@ -5,7 +5,6 @@ import datetime
from
django.utils
import
timezone
from
xmodule.modulestore.tests.factories
import
ItemFactory
,
CourseFactory
from
xmodule.modulestore.django
import
modulestore
from
student.models
import
CourseEnrollment
from
certificates.models
import
CertificateStatuses
from
certificates.tests.factories
import
GeneratedCertificateFactory
...
...
@@ -107,6 +106,23 @@ class TestUserEnrollmentApi(MobileAPITestCase, MobileAuthUserTestMixin, MobileEn
certificate_data
=
response
.
data
[
0
][
'certificate'
]
# pylint: disable=no-member
self
.
assertEquals
(
certificate_data
[
'url'
],
certificate_url
)
def
test_no_facebook_url
(
self
):
self
.
login_and_enroll
()
response
=
self
.
api_response
()
course_data
=
response
.
data
[
0
][
'course'
]
# pylint: disable=no-member
self
.
assertIsNone
(
course_data
[
'social_urls'
][
'facebook'
])
def
test_facebook_url
(
self
):
self
.
login_and_enroll
()
self
.
course
.
facebook_url
=
"http://facebook.com/test_group_page"
self
.
store
.
update_item
(
self
.
course
,
self
.
user
.
id
)
response
=
self
.
api_response
()
course_data
=
response
.
data
[
0
][
'course'
]
# pylint: disable=no-member
self
.
assertEquals
(
course_data
[
'social_urls'
][
'facebook'
],
self
.
course
.
facebook_url
)
class
CourseStatusAPITestCase
(
MobileAPITestCase
):
"""
...
...
@@ -280,7 +296,7 @@ class TestCourseEnrollmentSerializer(MobileAPITestCase):
self
.
course
.
display_coursenumber
=
"overridden_number"
self
.
course
.
display_organization
=
"overridden_org"
modulestore
()
.
update_item
(
self
.
course
,
self
.
user
.
id
)
self
.
store
.
update_item
(
self
.
course
,
self
.
user
.
id
)
serialized
=
CourseEnrollmentSerializer
(
CourseEnrollment
.
enrollments_for_user
(
self
.
user
)[
0
])
.
data
# pylint: disable=no-member
self
.
assertEqual
(
serialized
[
'course'
][
'number'
],
self
.
course
.
display_coursenumber
)
...
...
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