Merge remote-tracking branch 'origin/main'

This commit is contained in:
rimu 2024-05-26 14:09:59 +12:00
commit 11ce2919dd

View file

@ -490,6 +490,7 @@ def refresh_user_profile_task(user_id):
if 'icon' in activity_json:
if user.avatar_id and activity_json['icon']['url'] != user.avatar.source_url:
user.avatar.delete_from_disk()
if not user.avatar_id or (user.avatar_id and activity_json['icon']['url'] != user.avatar.source_url):
avatar = File(source_url=activity_json['icon']['url'])
user.avatar = avatar
db.session.add(avatar)
@ -497,6 +498,7 @@ def refresh_user_profile_task(user_id):
if 'image' in activity_json:
if user.cover_id and activity_json['image']['url'] != user.cover.source_url:
user.cover.delete_from_disk()
if not user.cover_id or (user.cover_id and activity_json['image']['url'] != user.cover.source_url):
cover = File(source_url=activity_json['image']['url'])
user.cover = cover
db.session.add(cover)
@ -564,6 +566,7 @@ def refresh_community_profile_task(community_id):
if 'icon' in activity_json:
if community.icon_id and activity_json['icon']['url'] != community.icon.source_url:
community.icon.delete_from_disk()
if not community.icon_id or (community.icon_id and activity_json['icon']['url'] != community.icon.source_url):
icon = File(source_url=activity_json['icon']['url'])
community.icon = icon
db.session.add(icon)
@ -571,6 +574,7 @@ def refresh_community_profile_task(community_id):
if 'image' in activity_json:
if community.image_id and activity_json['image']['url'] != community.image.source_url:
community.image.delete_from_disk()
if not community.image_id or (community.image_id and activity_json['image']['url'] != community.image.source_url):
image = File(source_url=activity_json['image']['url'])
community.image = image
db.session.add(image)