1
0
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:
zhengxie
2015-12-04 13:55:00 +08:00
parent 02bef78f7f
commit 7c06cbd76f

View File

@@ -29,12 +29,6 @@ def get_default_group_avatar_url():
return '%s%s' % (base_url, GROUP_AVATAR_DEFAULT_URL)
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)
if grp_avatars:
avatar = grp_avatars.order_by('-date_uploaded')[0]