mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-19 18:29:23 +00:00
[avatar] Fix cache bug in api_grp_avatar_url
This commit is contained in:
@@ -29,12 +29,6 @@ def get_default_group_avatar_url():
|
|||||||
return '%s%s' % (base_url, GROUP_AVATAR_DEFAULT_URL)
|
return '%s%s' % (base_url, GROUP_AVATAR_DEFAULT_URL)
|
||||||
|
|
||||||
def api_grp_avatar_url(group_id, size=GROUP_AVATAR_DEFAULT_SIZE):
|
def api_grp_avatar_url(group_id, size=GROUP_AVATAR_DEFAULT_SIZE):
|
||||||
key = get_grp_cache_key(group_id, size)
|
|
||||||
val = cache.get(key)
|
|
||||||
if val:
|
|
||||||
return val.avatar_url(size), False, val.date_uploaded
|
|
||||||
|
|
||||||
# Get from DB, and refresh cache
|
|
||||||
grp_avatars = GroupAvatar.objects.filter(group_id=group_id)
|
grp_avatars = GroupAvatar.objects.filter(group_id=group_id)
|
||||||
if grp_avatars:
|
if grp_avatars:
|
||||||
avatar = grp_avatars.order_by('-date_uploaded')[0]
|
avatar = grp_avatars.order_by('-date_uploaded')[0]
|
||||||
|
Reference in New Issue
Block a user