diff --git a/app/activitypub/util.py b/app/activitypub/util.py index afd4b85e..596e5a76 100644 --- a/app/activitypub/util.py +++ b/app/activitypub/util.py @@ -1539,9 +1539,10 @@ def create_post(activity_log: ActivityPubLog, community: Community, request_json if 'tag' in request_json['object'] and isinstance(request_json['object']['tag'], list): for json_tag in request_json['object']['tag']: if json_tag['type'] == 'Hashtag': - hashtag = find_hashtag_or_create(json_tag['name']) - if hashtag: - post.tags.append(hashtag) + if json_tag['name'][1:].lower() != post.community.name.lower(): # Lemmy adds the community slug as a hashtag on every post in the community, which we want to ignore + hashtag = find_hashtag_or_create(json_tag['name']) + if hashtag: + post.tags.append(hashtag) if 'image' in request_json['object'] and post.image is None: image = File(source_url=request_json['object']['image']['url']) db.session.add(image) diff --git a/app/utils.py b/app/utils.py index dc138048..536a3311 100644 --- a/app/utils.py +++ b/app/utils.py @@ -259,10 +259,9 @@ def markdown_to_text(markdown_text) -> str: def microblog_content_to_title(html: str) -> str: + title = '' if '

' in html: soup = BeautifulSoup(html, 'html.parser') - - title = '' for tag in soup.find_all('p'): title = tag.get_text(separator=" ") if title and title.strip() != '' and len(title.strip()) >= 5: