Skip to content

Commit

Permalink
Merge pull request #390 from ucsd-ets/release-candidate
Browse files Browse the repository at this point in the history
release-2020-07-08
  • Loading branch information
imhassantariq authored Jul 8, 2020
2 parents 4d13853 + 5640d8b commit f52970f
Show file tree
Hide file tree
Showing 12 changed files with 50 additions and 17 deletions.
6 changes: 4 additions & 2 deletions cms/static/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,9 @@ define(['domReady', 'jquery', 'underscore', 'js/utils/cancel_on_escape', 'js/vie

analytics.track('Created a Course', course_info);
CreateCourseUtils.create(course_info, function(errorMessage) {
var msg = edx.HtmlUtils.joinHtml(edx.HtmlUtils.HTML('<p>'), errorMessage, edx.HtmlUtils.HTML('</p>'));
$('.create-course .wrap-error').addClass('is-shown');
$('#course_creation_error').html('<p>' + errorMessage + '</p>');
edx.HtmlUtils.setHtml($('#course_creation_error'), msg);
$('.new-course-save').addClass('is-disabled').attr('aria-disabled', true);
});
};
Expand Down Expand Up @@ -136,8 +137,9 @@ define(['domReady', 'jquery', 'underscore', 'js/utils/cancel_on_escape', 'js/vie

analytics.track('Created a Library', lib_info);
CreateLibraryUtils.create(lib_info, function(errorMessage) {
var msg = edx.HtmlUtils.joinHtml(edx.HtmlUtils.HTML('<p>'), errorMessage, edx.HtmlUtils.HTML('</p>'));
$('.create-library .wrap-error').addClass('is-shown');
$('#library_creation_error').html('<p>' + errorMessage + '</p>');
edx.HtmlUtils.setHtml($('#library_creation_error'), msg);
$('.new-library-save').addClass('is-disabled').attr('aria-disabled', true);
});
};
Expand Down
4 changes: 2 additions & 2 deletions cms/static/js/models/uploads.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ define(['backbone', 'underscore', 'gettext'], function(Backbone, _, gettext) {
validate: function(attrs, options) {
if (attrs.selectedFile && !this.checkTypeValidity(attrs.selectedFile)) {
return {
message: _.template(gettext('Only <%= fileTypes %> files can be uploaded. Please select a file ending in <%= fileExtensions %> to upload.'))( // eslint-disable-line max-len
message: _.template(gettext('Only <%- fileTypes %> files can be uploaded. Please select a file ending in <%- (fileExtensions) %> to upload.'))( // eslint-disable-line max-len
this.formatValidTypes()
),
attributes: {selectedFile: true}
Expand Down Expand Up @@ -62,7 +62,7 @@ define(['backbone', 'underscore', 'gettext'], function(Backbone, _, gettext) {
}
var or = gettext('or');
var formatTypes = function(types) {
return _.template('<%= initial %> <%= or %> <%= last %>')({
return _.template('<%- initial %> <%- or %> <%- last %>')({
initial: _.initial(types).join(', '),
or: or,
last: _.last(types)
Expand Down
4 changes: 2 additions & 2 deletions cms/static/js/views/edit_chapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ define(['underscore', 'jquery', 'gettext', 'edx-ui-toolkit/js/utils/html-utils',
asset_path: this.$('input.chapter-asset-path').val()
});
var msg = new FileUploadModel({
title: _.template(gettext('Upload a new PDF to “<%= name %>”'))(
{name: course.escape('name')}),
title: _.template(gettext('Upload a new PDF to “<%- name %>”'))(
{name: course.get('name')}),
message: gettext('Please select a PDF file to upload.'),
mimeTypes: ['application/pdf']
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ class Migration(migrations.Migration):

operations = [
migrations.RunSQL(
'CREATE INDEX dcc_role_users_user_role_idx ON django_comment_client_role_users(user_id, role_id);'
),
'CREATE INDEX dcc_role_users_user_role_idx ON django_comment_client_role_users(user_id, role_id);',
reverse_sql='DROP INDEX dcc_role_users_user_role_idx ON django_comment_client_role_users;'),
]
5 changes: 5 additions & 0 deletions common/djangoapps/student/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -541,6 +541,11 @@ def requires_parental_consent(self, date=None, age_limit=None, default_requires_
Returns:
True if the user requires parental consent.
"""
# [UCSD_COUSTOM] if 'DISABLE_AGE_LIMIT_FOR_PROFILE' feature is enabled, it means we are not restricting the
# user for setting year_of_birth and bypassing the 13 year's age limit check for setting profile.
if settings.FEATURES.get('DISABLE_AGE_LIMIT_FOR_PROFILE'):
return False

if age_limit is None:
age_limit = getattr(settings, 'PARENTAL_CONSENT_AGE_LIMIT', None)
if age_limit is None:
Expand Down
2 changes: 1 addition & 1 deletion lms/envs/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -3494,5 +3494,5 @@ def _make_locale_paths(settings):
FEATURES['AUTOMATIC_PERMANENT_ACCOUNT_VERIFICATION'] = True
FEATURES['DISABLE_REFUND_FAILURE_NOTIFICATION'] = True
FEATURES['ENABLE_GEOGRAPHIC_DISCOUNTS'] = True

FEATURES['DISABLE_AGE_LIMIT_FOR_PROFILE'] = False
COUNTRIES_ELIGIBLE_FOR_DISCOUNTS = {}
6 changes: 6 additions & 0 deletions lms/envs/production.py
Original file line number Diff line number Diff line change
Expand Up @@ -1175,3 +1175,9 @@

if ENV_TOKENS.get('COUNTRIES_ELIGIBLE_FOR_DISCOUNTS'):
COUNTRIES_ELIGIBLE_FOR_DISCOUNTS = ENV_TOKENS.get('COUNTRIES_ELIGIBLE_FOR_DISCOUNTS')

# Analytics pixels settings
GOOGLE_COURSE_AUDIT_CONV_EVENT_ID = AUTH_TOKENS.get('GOOGLE_COURSE_AUDIT_CONV_EVENT_ID')
GOOGLE_AD_ACCOUNT = AUTH_TOKENS.get('GOOGLE_AD_ACCOUNT')
LINKEDIN_AD_ACCOUNT = AUTH_TOKENS.get('LINKEDIN_AD_ACCOUNT')
FACEBOOK_AD_ACCOUNT = AUTH_TOKENS.get('FACEBOOK_AD_ACCOUNT')
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 7 additions & 2 deletions lms/static/js/student_account/models/user_account_model.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,11 @@
accomplishments_shared: false,
default_public_account_fields: [],
extended_profile: [],
secondary_email: ''
secondary_email: '',
profile_visibility_override_flag: null
},


parse: function(response) {
if (_.isNull(response) || _.isUndefined(response)) {
return {};
Expand All @@ -38,7 +40,7 @@
// profile is public is to check if the api has returned fields other than the default public fields
// specified in settings.ACCOUNT_VISIBILITY_CONFIGURATION.
var responseKeys = _.filter(_.keys(response), function(key) {
return key !== 'default_public_account_fields';
return key !== 'default_public_account_fields' && key !== 'profile_visibility_override_flag';
});

var isPublic = _.size(_.difference(responseKeys, response.default_public_account_fields)) > 0;
Expand All @@ -56,6 +58,9 @@
},

isAboveMinimumAge: function() {
if (this.get('profile_visibility_override_flag')){
return true;
}
var yearOfBirth = this.get('year_of_birth');
var isBirthDefined = !(_.isUndefined(yearOfBirth) || _.isNull(yearOfBirth));
return isBirthDefined && !(this.get('requires_parental_consent'));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@
var accountSettingsModel = new AccountSettingsModel(
_.extend(
options.account_settings_data,
{default_public_account_fields: options.default_public_account_fields}
{
default_public_account_fields: options.default_public_account_fields,
profile_visibility_override_flag: options.profile_visibility_override_flag
}
),
{parse: true}
);
Expand Down Expand Up @@ -206,7 +209,8 @@
sectionOneFieldViews: sectionOneFieldViews,
sectionTwoFieldViews: sectionTwoFieldViews,
badgeListContainer: badgeListContainer,
platformName: options.platform_name
platformName: options.platform_name,
profile_visibility_override_flag: options.profile_visibility_override_flag
});

getProfileVisibility = function() {
Expand All @@ -230,7 +234,7 @@
};

if (options.has_preferences_access) {
if (accountSettingsModel.get('requires_parental_consent')) {
if (accountSettingsModel.get('requires_parental_consent') && !options.profile_visibility_override_flag) {
accountPreferencesModel.set('account_privacy', 'private');
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,15 @@
if (this.options.ownProfile) {
fieldView = this.options.accountPrivacyFieldView;
settings = this.options.accountSettingsModel;
fieldView.profileIsPrivate = !settings.get('year_of_birth');
fieldView.requiresParentalConsent = settings.get('requires_parental_consent');
fieldView.isAboveMinimumAge = settings.isAboveMinimumAge();
if (this.options.profile_visibility_override_flag) {
fieldView.profileIsPrivate = false;
fieldView.requiresParentalConsent = false;
fieldView.isAboveMinimumAge = true;
} else {
fieldView.profileIsPrivate = !settings.get('year_of_birth');
fieldView.requiresParentalConsent = settings.get('requires_parental_consent');
fieldView.isAboveMinimumAge = settings.isAboveMinimumAge();
}
fieldView.undelegateEvents();
this.$('.wrapper-profile-field-account-privacy').prepend(fieldView.render().el);
fieldView.delegateEvents();
Expand Down
5 changes: 5 additions & 0 deletions openedx/features/learner_profile/views/learner_profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,11 @@ def learner_profile_context(request, profile_username, user_is_staff):
'records_url': get_credentials_records_url(),
}

# [UCSD_COUSTOM] if 'DISABLE_AGE_LIMIT_FOR_PROFILE' feature is enabled, it means we are not restricting the user for
# setting year_of_birth and bypassing the 13 year's age limit check for setting profile.
if settings.FEATURES.get('DISABLE_AGE_LIMIT_FOR_PROFILE'):
context['data']['profile_visibility_override_flag'] = True

if badges_enabled():
context['data']['badges_api_url'] = reverse("badges_api:user_assertions", kwargs={'username': profile_username})

Expand Down

0 comments on commit f52970f

Please sign in to comment.