Fix share dedup

This commit is contained in:
Thomas Sileo 2022-08-26 21:23:16 +02:00
parent 0db6b0e2ba
commit dd4773fc27

View file

@ -1657,7 +1657,7 @@ async def _handle_announce_activity(
skip_delta = timedelta(hours=1) skip_delta = timedelta(hours=1)
if ( if (
now() - as_utc(relates_to_inbox_object.ap_published_at) # type: ignore now() - as_utc(relates_to_inbox_object.ap_published_at) # type: ignore
) > skip_delta or ( ) < skip_delta or (
await db_session.scalar( await db_session.scalar(
select(func.count(func.distinct(models.InboxObject.id))).where( select(func.count(func.distinct(models.InboxObject.id))).where(
models.InboxObject.ap_type == "Announce", models.InboxObject.ap_type == "Announce",
@ -1667,6 +1667,8 @@ async def _handle_announce_activity(
) )
) )
) > 0: ) > 0:
announce_activity.is_hidden_from_stream = True
else:
announce_activity.is_hidden_from_stream = not is_from_following announce_activity.is_hidden_from_stream = not is_from_following
else: else: