mirror of
https://codeberg.org/rimu/pyfedi
synced 2025-01-23 19:36:56 -08:00
Add option to boost votes for PeerTube videos
This commit is contained in:
parent
0d73c70cc9
commit
250405aafb
1 changed files with 6 additions and 1 deletions
|
@ -1747,7 +1747,12 @@ def update_post_from_activity(post: Post, request_json: dict):
|
||||||
upvotes += object['totalItems']
|
upvotes += object['totalItems']
|
||||||
if endpoint == 'dislikes':
|
if endpoint == 'dislikes':
|
||||||
downvotes += object['totalItems']
|
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.down_votes = downvotes
|
||||||
post.score = upvotes - downvotes
|
post.score = upvotes - downvotes
|
||||||
post.ranking = post.post_ranking(post.score, post.posted_at)
|
post.ranking = post.post_ranking(post.score, post.posted_at)
|
||||||
|
|
Loading…
Add table
Reference in a new issue