diff --git a/app/activitypub/util.py b/app/activitypub/util.py index 080c0b11..ec755ccc 100644 --- a/app/activitypub/util.py +++ b/app/activitypub/util.py @@ -967,10 +967,6 @@ def create_post_reply(activity_log: ActivityPubLog, community: Community, in_rep db.session.commit() if user.reputation > 100: - vote = PostReplyVote(user_id=1, author_id=post_reply.user_id, - post_reply_id=post_reply.id, - effect=instance_weight(user.ap_domain)) - db.session.add(vote) post_reply.up_votes += 1 post_reply.score += 1 post_reply.ranking = confidence(post_reply.up_votes, post_reply.down_votes) @@ -1056,10 +1052,6 @@ def create_post(activity_log: ActivityPubLog, community: Community, request_json notify_about_post(post) if user.reputation > 100: - vote = PostVote(user_id=1, author_id=post.user_id, - post_id=post.id, - effect=instance_weight(user.ap_domain)) - db.session.add(vote) post.up_votes += 1 post.score += 1 post.ranking = post_ranking(post.score, post.posted_at) diff --git a/app/community/util.py b/app/community/util.py index 4f0e95b0..d2c3df79 100644 --- a/app/community/util.py +++ b/app/community/util.py @@ -266,16 +266,10 @@ def save_post(form, post: Post): raise Exception('invalid post type') if post.id is None: if current_user.reputation > 100: - postvote = PostVote(user_id=1, author_id=current_user.id, post=post, effect=1.0) post.up_votes = 1 post.score = 1 - post.ranking = 1 - db.session.add(postvote) if current_user.reputation < -100: - postvote = PostVote(user_id=1, author_id=current_user.id, post=post, effect=-1.0) post.score = -1 - post.ranking = -1 - db.session.add(postvote) post.ranking = post_ranking(post.score, utcnow()) db.session.add(post) diff --git a/app/post/routes.py b/app/post/routes.py index 4f66b7e2..4d204fce 100644 --- a/app/post/routes.py +++ b/app/post/routes.py @@ -88,18 +88,12 @@ def show_post(post_id: int): db.session.commit() reply.ap_id = reply.profile_id() if current_user.reputation > 100: - reply_vote = PostReplyVote(user_id=1, author_id=current_user.id, post_reply_id=reply.id, - effect=1.0) reply.up_votes += 1 reply.score += 1 reply.ranking += 1 - db.session.add(reply_vote) elif current_user.reputation < -100: - reply_vote = PostReplyVote(user_id=1, author_id=current_user.id, post_reply_id=reply.id, - effect=-1.0) reply.score -= 1 reply.ranking -= 1 - db.session.add(reply_vote) db.session.commit() form.body.data = '' flash('Your comment has been added.') @@ -425,16 +419,12 @@ def add_reply(post_id: int, comment_id: int): reply.ap_id = reply.profile_id() db.session.commit() if current_user.reputation > 100: - reply_vote = PostReplyVote(user_id=1, author_id=current_user.id, post_reply_id=reply.id, effect=1.0) reply.up_votes += 1 reply.score += 1 reply.ranking += 1 - db.session.add(reply_vote) elif current_user.reputation < -100: - reply_vote = PostReplyVote(user_id=1, author_id=current_user.id, post_reply_id=reply.id, effect=-1.0) reply.score -= 1 reply.ranking -= 1 - db.session.add(reply_vote) post.reply_count = post_reply_count(post.id) post.last_active = post.community.last_active = utcnow() db.session.commit() diff --git a/app/utils.py b/app/utils.py index b3bec172..94b97d43 100644 --- a/app/utils.py +++ b/app/utils.py @@ -232,7 +232,7 @@ def html_to_markdown_worker(element, indent_level=0): def markdown_to_html(markdown_text) -> str: if markdown_text: - return allowlist_html(markdown2.markdown(markdown_text, safe_mode=True)) + return allowlist_html(markdown2.markdown(markdown_text, safe_mode=True, extras={'middle-word-em': False})) else: return '' diff --git a/requirements.txt b/requirements.txt index 9a9c9794..ca9ea92e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -19,7 +19,7 @@ pycryptodome==3.18.0 arrow==1.2.3 pyld==2.0.3 boto3==1.28.35 -markdown2==2.4.10 +markdown2==2.4.12 beautifulsoup4==4.12.2 flask-caching==2.0.2 Pillow