mirror of
https://codeberg.org/rimu/pyfedi
synced 2025-01-24 03:43:42 -08:00
When a post or postreply is created, record whether the author is a bot, for easier filtering #98 #114
This commit is contained in:
parent
40246fee1e
commit
43f0998391
2 changed files with 4 additions and 0 deletions
|
@ -1159,6 +1159,7 @@ def create_post_reply(activity_log: ActivityPubLog, community: Community, in_rep
|
||||||
root_id=root_id,
|
root_id=root_id,
|
||||||
nsfw=community.nsfw,
|
nsfw=community.nsfw,
|
||||||
nsfl=community.nsfl,
|
nsfl=community.nsfl,
|
||||||
|
from_bot=user.bot,
|
||||||
up_votes=1,
|
up_votes=1,
|
||||||
depth=depth,
|
depth=depth,
|
||||||
score=instance_weight(user.ap_domain),
|
score=instance_weight(user.ap_domain),
|
||||||
|
@ -1257,6 +1258,7 @@ def create_post(activity_log: ActivityPubLog, community: Community, request_json
|
||||||
ap_announce_id=announce_id,
|
ap_announce_id=announce_id,
|
||||||
type=constants.POST_TYPE_ARTICLE,
|
type=constants.POST_TYPE_ARTICLE,
|
||||||
up_votes=1,
|
up_votes=1,
|
||||||
|
from_bot=user.bot,
|
||||||
score=instance_weight(user.ap_domain),
|
score=instance_weight(user.ap_domain),
|
||||||
instance_id=user.instance_id,
|
instance_id=user.instance_id,
|
||||||
indexable=user.indexable
|
indexable=user.indexable
|
||||||
|
|
|
@ -15,6 +15,8 @@ def post_replies(post_id: int, sort_by: str, show_first: int = 0) -> List[PostRe
|
||||||
instance_ids = blocked_instances(current_user.id)
|
instance_ids = blocked_instances(current_user.id)
|
||||||
if instance_ids:
|
if instance_ids:
|
||||||
comments = comments.filter(or_(PostReply.instance_id.not_in(instance_ids), PostReply.instance_id == None))
|
comments = comments.filter(or_(PostReply.instance_id.not_in(instance_ids), PostReply.instance_id == None))
|
||||||
|
if current_user.ignore_bots:
|
||||||
|
comments = comments.filter(PostReply.from_bot == False)
|
||||||
if sort_by == 'hot':
|
if sort_by == 'hot':
|
||||||
comments = comments.order_by(desc(PostReply.ranking))
|
comments = comments.order_by(desc(PostReply.ranking))
|
||||||
elif sort_by == 'top':
|
elif sort_by == 'top':
|
||||||
|
|
Loading…
Add table
Reference in a new issue