mirror of
https://codeberg.org/rimu/pyfedi
synced 2025-01-23 19:36:56 -08:00
no point using redis caching when the relationship is joined anyway
This commit is contained in:
parent
c652be4024
commit
ef1550f578
3 changed files with 0 additions and 12 deletions
|
@ -555,11 +555,8 @@ def refresh_user_profile_task(user_id):
|
|||
session.commit()
|
||||
if user.avatar_id and avatar_changed:
|
||||
make_image_sizes(user.avatar_id, 40, 250, 'users')
|
||||
cache.delete_memoized(User.avatar_image, user)
|
||||
cache.delete_memoized(User.avatar_thumbnail, user)
|
||||
if user.cover_id and cover_changed:
|
||||
make_image_sizes(user.cover_id, 700, 1600, 'users')
|
||||
cache.delete_memoized(User.cover_image, user)
|
||||
session.close()
|
||||
|
||||
|
||||
|
|
|
@ -770,7 +770,6 @@ class User(UserMixin, db.Model):
|
|||
else:
|
||||
return '[deleted]'
|
||||
|
||||
@cache.memoize(timeout=500)
|
||||
def avatar_thumbnail(self) -> str:
|
||||
if self.avatar_id is not None:
|
||||
if self.avatar.thumbnail_path is not None:
|
||||
|
@ -782,7 +781,6 @@ class User(UserMixin, db.Model):
|
|||
return self.avatar_image()
|
||||
return ''
|
||||
|
||||
@cache.memoize(timeout=500)
|
||||
def avatar_image(self) -> str:
|
||||
if self.avatar_id is not None:
|
||||
if self.avatar.file_path is not None:
|
||||
|
@ -797,7 +795,6 @@ class User(UserMixin, db.Model):
|
|||
return self.avatar.source_url
|
||||
return ''
|
||||
|
||||
@cache.memoize(timeout=500)
|
||||
def cover_image(self) -> str:
|
||||
if self.cover_id is not None:
|
||||
if self.cover.thumbnail_path is not None:
|
||||
|
|
|
@ -153,8 +153,6 @@ def edit_profile(actor):
|
|||
file = save_icon_file(profile_file, 'users')
|
||||
if file:
|
||||
current_user.avatar = file
|
||||
cache.delete_memoized(User.avatar_image, current_user)
|
||||
cache.delete_memoized(User.avatar_thumbnail, current_user)
|
||||
banner_file = request.files['banner_file']
|
||||
if banner_file and banner_file.filename != '':
|
||||
# remove old cover
|
||||
|
@ -168,7 +166,6 @@ def edit_profile(actor):
|
|||
file = save_banner_file(banner_file, 'users')
|
||||
if file:
|
||||
current_user.cover = file
|
||||
cache.delete_memoized(User.cover_image, current_user)
|
||||
|
||||
db.session.commit()
|
||||
|
||||
|
@ -207,8 +204,6 @@ def remove_avatar():
|
|||
current_user.avatar_id = None
|
||||
db.session.delete(file)
|
||||
db.session.commit()
|
||||
cache.delete_memoized(User.avatar_image, current_user)
|
||||
cache.delete_memoized(User.avatar_thumbnail, current_user)
|
||||
return _('Avatar removed!')
|
||||
|
||||
|
||||
|
@ -223,7 +218,6 @@ def remove_cover():
|
|||
current_user.cover_id = None
|
||||
db.session.delete(file)
|
||||
db.session.commit()
|
||||
cache.delete_memoized(User.cover_image, current_user)
|
||||
return '<div> ' + _('Banner removed!') + '</div>'
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue