Backfill: ignore community slug that Lemmy adds as a hashtag

This commit is contained in:
freamon 2024-09-04 22:28:08 +00:00
parent 54254b11c2
commit a4d981d431

View file

@ -925,9 +925,11 @@ def post_json_to_model(activity_log, post_json, user, community) -> Post:
if 'tag' in post_json:
for json_tag in post_json['tag']:
if json_tag['type'] == 'Hashtag':
hashtag = find_hashtag_or_create(json_tag['name'])
if hashtag:
post.tags.append(hashtag)
# Lemmy adds the community slug as a hashtag on every post in the community, which we want to ignore
if json_tag['name'][1:].lower() != community.name.lower():
hashtag = find_hashtag_or_create(json_tag['name'])
if hashtag:
post.tags.append(hashtag)
if post is not None:
if 'image' in post_json and post.image is None: