mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-11-26 19:41:11 +00:00
Merge pull request #2793 from WesleyAC/ignore-activity-allow-external-connections
Pass allow_external_connections through ignore_activity
This commit is contained in:
commit
5bcd294f47
3 changed files with 11 additions and 4 deletions
|
@ -127,7 +127,7 @@ class ActivityObject:
|
||||||
if (
|
if (
|
||||||
allow_create
|
allow_create
|
||||||
and hasattr(model, "ignore_activity")
|
and hasattr(model, "ignore_activity")
|
||||||
and model.ignore_activity(self)
|
and model.ignore_activity(self, allow_external_connections)
|
||||||
):
|
):
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
|
@ -20,8 +20,9 @@ class Favorite(ActivityMixin, BookWyrmModel):
|
||||||
|
|
||||||
activity_serializer = activitypub.Like
|
activity_serializer = activitypub.Like
|
||||||
|
|
||||||
|
# pylint: disable=unused-argument
|
||||||
@classmethod
|
@classmethod
|
||||||
def ignore_activity(cls, activity):
|
def ignore_activity(cls, activity, allow_external_connections=True):
|
||||||
"""don't bother with incoming favs of unknown statuses"""
|
"""don't bother with incoming favs of unknown statuses"""
|
||||||
return not Status.objects.filter(remote_id=activity.object).exists()
|
return not Status.objects.filter(remote_id=activity.object).exists()
|
||||||
|
|
||||||
|
|
|
@ -116,10 +116,16 @@ class Status(OrderedCollectionPageMixin, BookWyrmModel):
|
||||||
return list(set(mentions))
|
return list(set(mentions))
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def ignore_activity(cls, activity): # pylint: disable=too-many-return-statements
|
def ignore_activity(
|
||||||
|
cls, activity, allow_external_connections=True
|
||||||
|
): # pylint: disable=too-many-return-statements
|
||||||
"""keep notes if they are replies to existing statuses"""
|
"""keep notes if they are replies to existing statuses"""
|
||||||
if activity.type == "Announce":
|
if activity.type == "Announce":
|
||||||
boosted = activitypub.resolve_remote_id(activity.object, get_activity=True)
|
boosted = activitypub.resolve_remote_id(
|
||||||
|
activity.object,
|
||||||
|
get_activity=True,
|
||||||
|
allow_external_connections=allow_external_connections,
|
||||||
|
)
|
||||||
if not boosted:
|
if not boosted:
|
||||||
# if we can't load the status, definitely ignore it
|
# if we can't load the status, definitely ignore it
|
||||||
return True
|
return True
|
||||||
|
|
Loading…
Reference in a new issue