Merge pull request #33186 from thezaeemaanwar/remove_badges_app
[DEPR]: lms/djangoapps/badges
This commit is contained in:
@@ -21,7 +21,6 @@ from common.djangoapps.student.models import (
|
||||
UserPasswordToggleHistory,
|
||||
UserProfile
|
||||
)
|
||||
from lms.djangoapps.badges.utils import badges_enabled
|
||||
from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers
|
||||
from openedx.core.djangoapps.user_api import errors
|
||||
from openedx.core.djangoapps.user_api.accounts.utils import is_secondary_email_feature_enabled
|
||||
@@ -136,7 +135,6 @@ class UserReadOnlySerializer(serializers.Serializer): # lint-amnesty, pylint: d
|
||||
except ObjectDoesNotExist:
|
||||
activation_key = None
|
||||
|
||||
accomplishments_shared = badges_enabled()
|
||||
data = {
|
||||
"username": user.username,
|
||||
"url": self.context.get('request').build_absolute_uri(
|
||||
@@ -164,7 +162,6 @@ class UserReadOnlySerializer(serializers.Serializer): # lint-amnesty, pylint: d
|
||||
"level_of_education": None,
|
||||
"mailing_address": None,
|
||||
"requires_parental_consent": None,
|
||||
"accomplishments_shared": accomplishments_shared,
|
||||
"account_privacy": self.configuration.get('default_visibility'),
|
||||
"social_links": None,
|
||||
"extended_profile_fields": None,
|
||||
|
||||
@@ -625,7 +625,6 @@ class AccountSettingsOnCreationTest(CreateAccountMixin, TestCase):
|
||||
'requires_parental_consent': True,
|
||||
'language_proficiencies': [],
|
||||
'account_privacy': PRIVATE_VISIBILITY,
|
||||
'accomplishments_shared': False,
|
||||
'extended_profile': [],
|
||||
'secondary_email': None,
|
||||
'secondary_email_enabled': None,
|
||||
|
||||
@@ -359,7 +359,7 @@ class TestAccountsAPI(FilteredQueryCountMixin, CacheIsolationTestCase, UserAPITe
|
||||
|
||||
ENABLED_CACHES = ['default']
|
||||
TOTAL_QUERY_COUNT = 24
|
||||
FULL_RESPONSE_FIELD_COUNT = 30
|
||||
FULL_RESPONSE_FIELD_COUNT = 29
|
||||
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
@@ -379,12 +379,12 @@ class TestAccountsAPI(FilteredQueryCountMixin, CacheIsolationTestCase, UserAPITe
|
||||
legacy_profile.save()
|
||||
return year_of_birth
|
||||
|
||||
def _verify_full_shareable_account_response(self, response, account_privacy=None, badges_enabled=False):
|
||||
def _verify_full_shareable_account_response(self, response, account_privacy=None):
|
||||
"""
|
||||
Verify that the shareable fields from the account are returned
|
||||
"""
|
||||
data = response.data
|
||||
assert 12 == len(data)
|
||||
assert 11 == len(data)
|
||||
|
||||
# public fields (3)
|
||||
assert account_privacy == data['account_privacy']
|
||||
@@ -399,7 +399,6 @@ class TestAccountsAPI(FilteredQueryCountMixin, CacheIsolationTestCase, UserAPITe
|
||||
assert 'm' == data['level_of_education']
|
||||
assert data['social_links'] is not None
|
||||
assert data['time_zone'] is None
|
||||
assert badges_enabled == data['accomplishments_shared']
|
||||
|
||||
def _verify_private_account_response(self, response, requires_parental_consent=False):
|
||||
"""
|
||||
@@ -436,7 +435,6 @@ class TestAccountsAPI(FilteredQueryCountMixin, CacheIsolationTestCase, UserAPITe
|
||||
assert 'm' == data['level_of_education']
|
||||
assert data['social_links'] is not None
|
||||
assert UserPreference.get_value(self.user, 'time_zone') == data['time_zone']
|
||||
assert data['accomplishments_shared'] is not None
|
||||
assert ((self.user.first_name + ' ') + self.user.last_name) == data['name']
|
||||
|
||||
# additional admin fields (13)
|
||||
@@ -669,7 +667,6 @@ class TestAccountsAPI(FilteredQueryCountMixin, CacheIsolationTestCase, UserAPITe
|
||||
response = self.send_get(self.different_client)
|
||||
self._verify_private_account_response(response)
|
||||
|
||||
@mock.patch.dict(settings.FEATURES, {'ENABLE_OPENBADGES': True})
|
||||
@ddt.data(
|
||||
("client", "user", PRIVATE_VISIBILITY),
|
||||
("different_client", "different_user", PRIVATE_VISIBILITY),
|
||||
@@ -691,7 +688,7 @@ class TestAccountsAPI(FilteredQueryCountMixin, CacheIsolationTestCase, UserAPITe
|
||||
if preference_visibility == PRIVATE_VISIBILITY:
|
||||
self._verify_private_account_response(response)
|
||||
else:
|
||||
self._verify_full_shareable_account_response(response, ALL_USERS_VISIBILITY, badges_enabled=True)
|
||||
self._verify_full_shareable_account_response(response, ALL_USERS_VISIBILITY)
|
||||
|
||||
client = self.login_client(api_client, requesting_username)
|
||||
|
||||
@@ -812,8 +809,6 @@ class TestAccountsAPI(FilteredQueryCountMixin, CacheIsolationTestCase, UserAPITe
|
||||
assert [] == data['language_proficiencies']
|
||||
assert PRIVATE_VISIBILITY == data['account_privacy']
|
||||
assert data['time_zone'] is None
|
||||
# Badges aren't on by default, so should not be present.
|
||||
assert data['accomplishments_shared'] is False
|
||||
|
||||
self.client.login(username=self.user.username, password=TEST_PASSWORD)
|
||||
verify_get_own_information(self._get_num_queries(22))
|
||||
|
||||
@@ -244,9 +244,6 @@ class AccountViewSet(ViewSet):
|
||||
If "custom", the user has selectively chosen a subset of shareable
|
||||
fields to make visible to others via the User Preferences API.
|
||||
|
||||
* accomplishments_shared: Signals whether badges are enabled on the
|
||||
platform and should be fetched.
|
||||
|
||||
* phone_number: The phone number for the user. String of numbers with
|
||||
an optional `+` sign at the start.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user