mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-02 07:27:04 +00:00
[api2] Refresh cache when update account
This commit is contained in:
@@ -19,8 +19,8 @@ from seahub.api2.utils import api_error, to_python_boolean
|
||||
from seahub.api2.status import HTTP_520_OPERATION_FAILED
|
||||
from seahub.base.accounts import User
|
||||
from seahub.profile.models import Profile
|
||||
from seahub.profile.utils import refresh_cache as refresh_profile_cache
|
||||
from seahub.utils import is_valid_username
|
||||
from seahub.views import get_owned_repo_list
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
json_content_type = 'application/json; charset=utf-8'
|
||||
@@ -75,6 +75,7 @@ class Account(APIView):
|
||||
profile.intro = note
|
||||
|
||||
profile.save()
|
||||
refresh_profile_cache(email)
|
||||
|
||||
def _update_account_quota(self, request, email):
|
||||
storage = request.DATA.get("storage", None)
|
||||
|
@@ -5,6 +5,7 @@ import seaserv
|
||||
from seaserv import seafile_api
|
||||
|
||||
from seahub.base.accounts import User
|
||||
from seahub.base.templatetags.seahub_tags import email2nickname
|
||||
from seahub.profile.models import Profile
|
||||
from seahub.test_utils import BaseTestCase
|
||||
from tests.common.utils import randstring
|
||||
@@ -105,6 +106,16 @@ class AccountTest(BaseTestCase):
|
||||
self.assertEqual(seafile_api.get_user_quota(
|
||||
self.user1.username), 102400)
|
||||
|
||||
def test_refresh_profile_cache_after_update(self):
|
||||
self.login_as(self.admin)
|
||||
self.assertEqual(email2nickname(self.user1.username),
|
||||
self.user1.username.split('@')[0])
|
||||
|
||||
resp = self._do_update()
|
||||
self.assertEqual(200, resp.status_code)
|
||||
|
||||
self.assertEqual(email2nickname(self.user1.username), 'user1')
|
||||
|
||||
def test_migrate(self):
|
||||
self.login_as(self.admin)
|
||||
|
||||
|
Reference in New Issue
Block a user