update existing community language

This commit is contained in:
rimu 2024-04-18 13:57:33 +12:00
parent a8f7ebf442
commit a4991090fd
2 changed files with 6 additions and 1 deletions

View file

@ -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')

View file

@ -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)