Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: control linked account by settings (#675) #3

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
return function(
fieldsData,
disableOrderHistoryTab,
showLinkedAccountsTab,
ordersHistoryData,
authData,
passwordResetSupportUrl,
Expand Down Expand Up @@ -439,6 +440,7 @@
},
userPreferencesModel: userPreferencesModel,
disableOrderHistoryTab: disableOrderHistoryTab,
showLinkedAccountsTab: showLinkedAccountsTab,
betaLanguage: betaLanguage
});

Expand Down
9 changes: 6 additions & 3 deletions lms/static/js/student_account/views/account_settings_view.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,18 @@
selected: true,
expanded: true
},
{
];

if (view.options.showLinkedAccountsTab) {
accountSettingsTabs.push({
name: 'accountsTabSections',
id: 'accounts-tab',
label: gettext('Linked Accounts'),
tabindex: -1,
selected: false,
expanded: false
}
];
});
}
if (!view.options.disableOrderHistoryTab) {
accountSettingsTabs.push({
name: 'ordersTabSections',
Expand Down
1 change: 1 addition & 0 deletions lms/templates/student_account/account_settings.html
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
AccountSettingsFactory(
fieldsData,
${ disable_order_history_tab | n, dump_js_escaped_json },
${ show_linked_accounts_tab | n, dump_js_escaped_json },
ordersHistoryData,
authData,
'${ password_reset_support_link | n, js_escaped_string }',
Expand Down
4 changes: 3 additions & 1 deletion openedx/core/djangoapps/user_api/accounts/settings_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers
from openedx.core.djangoapps.user_api.accounts.toggles import (
should_redirect_to_account_microfrontend,
should_redirect_to_order_history_microfrontend
should_redirect_to_order_history_microfrontend,
should_show_linked_accounts_tab
)
from openedx.core.djangoapps.user_api.preferences.api import get_user_preferences
from openedx.core.lib.edx_api_utils import get_api_data
Expand Down Expand Up @@ -159,6 +160,7 @@ def account_settings_context(request):
'show_dashboard_tabs': True,
'order_history': user_orders,
'disable_order_history_tab': should_redirect_to_order_history_microfrontend(),
'show_linked_accounts_tab': should_show_linked_accounts_tab(),
'enable_account_deletion': configuration_helpers.get_value(
'ENABLE_ACCOUNT_DELETION', settings.FEATURES.get('ENABLE_ACCOUNT_DELETION', False)
),
Expand Down
7 changes: 7 additions & 0 deletions openedx/core/djangoapps/user_api/accounts/toggles.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@ def should_redirect_to_order_history_microfrontend():
)


def should_show_linked_accounts_tab():
"""Check if the the var `SHOW_LINKED_ACCOUNTS`
is defined in configuration helpers.
"""
return configuration_helpers.get_value('SHOW_LINKED_ACCOUNTS', True)


# .. toggle_name: account.redirect_to_microfrontend
# .. toggle_implementation: WaffleFlag
# .. toggle_default: False
Expand Down