mirror of
https://codeberg.org/rimu/pyfedi
synced 2025-01-24 03:43:42 -08:00
adding blocked users to export
This commit is contained in:
parent
77c5278996
commit
6677aa506c
1 changed files with 16 additions and 0 deletions
|
@ -242,6 +242,13 @@ def export_user_settings(user):
|
||||||
user_dict['avatar_image'] = f"https://{current_app.config['SERVER_NAME']}/{user.avatar_image()}"
|
user_dict['avatar_image'] = f"https://{current_app.config['SERVER_NAME']}/{user.avatar_image()}"
|
||||||
if user.cover_image() != '':
|
if user.cover_image() != '':
|
||||||
user_dict['cover_image'] = f"https://{current_app.config['SERVER_NAME']}/{user.cover_image()}"
|
user_dict['cover_image'] = f"https://{current_app.config['SERVER_NAME']}/{user.cover_image()}"
|
||||||
|
# get blocked users
|
||||||
|
blocked_users = []
|
||||||
|
user_blocks = UserBlock.query.filter_by(blocker_id=user.id).all()
|
||||||
|
for ub in user_blocks:
|
||||||
|
blocked_user = User.query.filter_by(id=ub.blocked_id).first()
|
||||||
|
blocked_users.append(blocked_user.ap_public_url)
|
||||||
|
user_dict['user_blocks'] = blocked_users
|
||||||
|
|
||||||
# lemmy output compatibility
|
# lemmy output compatibility
|
||||||
user_dict['display_name'] = user.title
|
user_dict['display_name'] = user.title
|
||||||
|
@ -268,6 +275,7 @@ def export_user_settings(user):
|
||||||
"default_listing_type": f'{user.default_filter}'.capitalize(),
|
"default_listing_type": f'{user.default_filter}'.capitalize(),
|
||||||
"interface_language": user.interface_language
|
"interface_language": user.interface_language
|
||||||
}
|
}
|
||||||
|
user_dict['blocked_users'] = blocked_users
|
||||||
|
|
||||||
# get the user subscribed communities' ap_profile_id
|
# get the user subscribed communities' ap_profile_id
|
||||||
user_subscribed_communities = []
|
user_subscribed_communities = []
|
||||||
|
@ -278,6 +286,14 @@ def export_user_settings(user):
|
||||||
user_subscribed_communities.append(c.ap_profile_id)
|
user_subscribed_communities.append(c.ap_profile_id)
|
||||||
user_dict['followed_communities'] = user_subscribed_communities
|
user_dict['followed_communities'] = user_subscribed_communities
|
||||||
|
|
||||||
|
# get bookmrked/saved posts
|
||||||
|
# get bookmarked/saved comments
|
||||||
|
# get blocked communities
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# get blocked instances
|
||||||
|
|
||||||
# setup the BytesIO buffer
|
# setup the BytesIO buffer
|
||||||
buffer = BytesIO()
|
buffer = BytesIO()
|
||||||
buffer.write(str(python_json.dumps(user_dict)).encode('utf-8'))
|
buffer.write(str(python_json.dumps(user_dict)).encode('utf-8'))
|
||||||
|
|
Loading…
Add table
Reference in a new issue