From 250405aafb558c533e7c13035e3120269b72bc75 Mon Sep 17 00:00:00 2001 From: freamon Date: Thu, 9 Jan 2025 16:46:06 +0000 Subject: [PATCH] Add option to boost votes for PeerTube videos --- app/activitypub/util.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/activitypub/util.py b/app/activitypub/util.py index ecf3ff76..2d5a94ef 100644 --- a/app/activitypub/util.py +++ b/app/activitypub/util.py @@ -1747,7 +1747,12 @@ def update_post_from_activity(post: Post, request_json: dict): upvotes += object['totalItems'] if endpoint == 'dislikes': downvotes += object['totalItems'] - post.up_votes = upvotes + + # this uses the instance the post is from, rather the instances of individual votes. Useful for promoting PeerTube vids over Lemmy posts. + multiplier = post.instance.vote_weight + if not multiplier: + multiplier = 1.0 + post.up_votes = upvotes * multiplier post.down_votes = downvotes post.score = upvotes - downvotes post.ranking = post.post_ranking(post.score, post.posted_at)