Merge remote-tracking branch 'origin/master' into will/combine-reg-login-form
This commit is contained in:
@@ -145,10 +145,10 @@ class Migration(DataMigration):
|
||||
if self.mongostore is not None:
|
||||
course_son = bson.son.SON([
|
||||
('_id.tag', 'i4x'),
|
||||
('_id.org', re.compile(r'^{}$'.format(downcased_ssck.org), re.IGNORECASE)),
|
||||
('_id.course', re.compile(r'^{}$'.format(downcased_ssck.course), re.IGNORECASE)),
|
||||
('_id.org', re.compile(ur'^{}$'.format(downcased_ssck.org), re.IGNORECASE | re.UNICODE)),
|
||||
('_id.course', re.compile(ur'^{}$'.format(downcased_ssck.course), re.IGNORECASE | re.UNICODE)),
|
||||
('_id.category', 'course'),
|
||||
('_id.name', re.compile(r'^{}$'.format(downcased_ssck.run), re.IGNORECASE)),
|
||||
('_id.name', re.compile(ur'^{}$'.format(downcased_ssck.run), re.IGNORECASE | re.UNICODE)),
|
||||
])
|
||||
entry = self.mongostore.collection.find_one(course_son)
|
||||
if entry:
|
||||
|
||||
@@ -112,10 +112,10 @@ class Migration(DataMigration):
|
||||
if self.mongostore is not None:
|
||||
course_son = bson.son.SON([
|
||||
('_id.tag', 'i4x'),
|
||||
('_id.org', re.compile(r'^{}$'.format(downcased_ssck.org), re.IGNORECASE)),
|
||||
('_id.course', re.compile(r'^{}$'.format(downcased_ssck.course), re.IGNORECASE)),
|
||||
('_id.org', re.compile(ur'^{}$'.format(downcased_ssck.org), re.IGNORECASE | re.UNICODE)),
|
||||
('_id.course', re.compile(ur'^{}$'.format(downcased_ssck.course), re.IGNORECASE | re.UNICODE)),
|
||||
('_id.category', 'course'),
|
||||
('_id.name', re.compile(r'^{}$'.format(downcased_ssck.run), re.IGNORECASE)),
|
||||
('_id.name', re.compile(ur'^{}$'.format(downcased_ssck.run), re.IGNORECASE | re.UNICODE)),
|
||||
])
|
||||
entry = self.mongostore.collection.find_one(course_son)
|
||||
if entry:
|
||||
|
||||
@@ -447,13 +447,17 @@ def is_course_blocked(request, redeemed_registration_codes, course_key):
|
||||
"""Checking either registration is blocked or not ."""
|
||||
blocked = False
|
||||
for redeemed_registration in redeemed_registration_codes:
|
||||
if not getattr(redeemed_registration.invoice, 'is_valid'):
|
||||
blocked = True
|
||||
# disabling email notifications for unpaid registration courses
|
||||
Optout.objects.get_or_create(user=request.user, course_id=course_key)
|
||||
log.info(u"User {0} ({1}) opted out of receiving emails from course {2}".format(request.user.username, request.user.email, course_key))
|
||||
track.views.server_track(request, "change-email1-settings", {"receive_emails": "no", "course": course_key.to_deprecated_string()}, page='dashboard')
|
||||
break
|
||||
# registration codes may be generated via Bulk Purchase Scenario
|
||||
# we have to check only for the invoice generated registration codes
|
||||
# that their invoice is valid or not
|
||||
if redeemed_registration.invoice:
|
||||
if not getattr(redeemed_registration.invoice, 'is_valid'):
|
||||
blocked = True
|
||||
# disabling email notifications for unpaid registration courses
|
||||
Optout.objects.get_or_create(user=request.user, course_id=course_key)
|
||||
log.info(u"User {0} ({1}) opted out of receiving emails from course {2}".format(request.user.username, request.user.email, course_key))
|
||||
track.views.server_track(request, "change-email1-settings", {"receive_emails": "no", "course": course_key.to_deprecated_string()}, page='dashboard')
|
||||
break
|
||||
|
||||
return blocked
|
||||
|
||||
|
||||
Reference in New Issue
Block a user