mirror of
https://codeberg.org/rimu/pyfedi
synced 2025-01-23 19:36:56 -08:00
For a.gup.pe groups, send votes to post author instead of to community
This commit is contained in:
parent
773ba7040c
commit
cb28b79108
2 changed files with 6 additions and 2 deletions
|
@ -85,7 +85,7 @@ class Instance(db.Model):
|
|||
def votes_are_public(self):
|
||||
if self.trusted is True: # only vote privately with untrusted instances
|
||||
return False
|
||||
return self.software.lower() == 'lemmy' or self.software.lower() == 'mbin' or self.software.lower() == 'kbin'
|
||||
return self.software.lower() == 'lemmy' or self.software.lower() == 'mbin' or self.software.lower() == 'kbin' or self.software.lower() == 'guppe groups'
|
||||
|
||||
def post_count(self):
|
||||
return db.session.execute(text('SELECT COUNT(id) as c FROM "post" WHERE instance_id = :instance_id'),
|
||||
|
|
|
@ -324,7 +324,11 @@ def post_vote(post_id: int, vote_direction):
|
|||
if instance.inbox and not current_user.has_blocked_instance(instance.id) and not instance_banned(instance.domain):
|
||||
send_to_remote_instance(instance.id, post.community.id, announce)
|
||||
else:
|
||||
post_request_in_background(post.community.ap_inbox_url, action_json, current_user.private_key,
|
||||
inbox = post.community.ap_inbox_url
|
||||
if (post.community.ap_domain and post.author.ap_inbox_url and # sanity check these fields aren't null
|
||||
post.community.ap_domain == 'a.gup.pe' and vote_direction == 'upvote'): # send upvotes to post author's instance instead of a.gup.pe (who reject them)
|
||||
inbox = post.author.ap_inbox_url
|
||||
post_request_in_background(inbox, action_json, current_user.private_key,
|
||||
current_user.public_url(not(post.community.instance.votes_are_public() and current_user.vote_privately())) + '#main-key')
|
||||
|
||||
recently_upvoted = []
|
||||
|
|
Loading…
Reference in a new issue