From a4991090fd7a94abc6f0cd98173d0ac955c3be23 Mon Sep 17 00:00:00 2001 From: rimu <3310831+rimu@users.noreply.github.com> Date: Thu, 18 Apr 2024 13:57:33 +1200 Subject: [PATCH] update existing community language --- app/activitypub/util.py | 5 +++++ app/main/routes.py | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/app/activitypub/util.py b/app/activitypub/util.py index e110608b..a6f00410 100644 --- a/app/activitypub/util.py +++ b/app/activitypub/util.py @@ -505,6 +505,11 @@ def refresh_community_profile_task(community_id): community.image = image db.session.add(image) cover_changed = True + if 'language' in activity_json and isinstance(activity_json['language'], list): + for ap_language in activity_json['language']: + new_language = find_language_or_create(ap_language['identifier'], ap_language['name']) + if new_language not in community.langauges: + community.languages.append(new_language) db.session.commit() if community.icon_id and icon_changed: make_image_sizes(community.icon_id, 60, 250, 'communities') diff --git a/app/main/routes.py b/app/main/routes.py index bdc8a796..e85a6f7f 100644 --- a/app/main/routes.py +++ b/app/main/routes.py @@ -301,7 +301,7 @@ def list_files(directory): @bp.route('/test') def test(): - x = find_actor_or_create('https://lemmy.ml/u/const_void') + md = "::: spoiler I'm all for ya having fun and your right to hurt yourself.\n\nI am a former racer, commuter, and professional Buyer for a chain of bike shops. I'm also disabled from the crash involving the 6th and 7th cars that have hit me in the last 170k+ miles of riding. I only barely survived what I simplify as a \"broken neck and back.\" Cars making U-turns are what will get you if you ride long enough, \n\nespecially commuting. It will look like just another person turning in front of you, you'll compensate like usual, and before your brain can even register what is really happening, what was your normal escape route will close and you're going to crash really hard. It is the only kind of crash that your intuition is useless against.\n:::" return markdown_to_html(md)